本文整理汇总了C#中MainPage类的典型用法代码示例。如果您正苦于以下问题:C# MainPage类的具体用法?C# MainPage怎么用?C# MainPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainPage类属于命名空间,在下文中一共展示了MainPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnApplicationStartup
/// <summary>
/// Handles the Startup event of the Application control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.StartupEventArgs"/> instance containing the event data.</param>
private void OnApplicationStartup(object sender, StartupEventArgs e)
{
Catel.Windows.StyleHelper.CreateStyleForwardersForDefaultStyles();
var serviceLocator = ServiceLocator.Default;
serviceLocator.RegisterType<IViewLocator, ViewLocator>();
var viewLocator = serviceLocator.ResolveType<IViewLocator>();
viewLocator.NamingConventions.Add("[UP].Views.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]View");
viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]Window");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]View");
viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]Window");
serviceLocator.RegisterType<IViewModelLocator, ViewModelLocator>();
var viewModelLocator = serviceLocator.ResolveType<IViewModelLocator>();
viewModelLocator.NamingConventions.Add("Catel.Examples.AdvancedDemo.ViewModels.[VW]ViewModel");
// Register several different external IoC containers for demo purposes
IoCHelper.MefContainer = new CompositionContainer();
IoCHelper.UnityContainer = new UnityContainer();
serviceLocator.RegisterExternalContainer(IoCHelper.MefContainer);
serviceLocator.RegisterExternalContainer(IoCHelper.UnityContainer);
RootVisual = new MainPage();
}
开发者ID:nix63,项目名称:Catel.Examples,代码行数:32,代码来源:App.xaml.cs
示例2: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
//Listen to AccountPictureChanged event
UserInformation.AccountPictureChanged += this.PictureChanged;
}
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:7,代码来源:setaccountpicture.xaml.cs
示例3: OnNavigatedTo
/// <summary>
/// Clean up the notification area when user navigate to prediction page
/// </summary>
/// <param name="e">Event data that describes the click action on the button.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// Clean notification area.
rootPage.NotifyUser(string.Empty, NotifyType.StatusMessage);
}
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:11,代码来源:Scenario3_ReverseConversion.xaml.cs
示例4: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
activeAccount = (Account)e.Parameter;
//set inkCanvas size
rootPage = MainPage.Current;
this.SetGridSize();
}
开发者ID:XPOWERLM,项目名称:More-Personal-Computing,代码行数:7,代码来源:AccountDetails.xaml.cs
示例5: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// The AccountCommandsRequested event triggers before the Accounts settings pane is displayed
AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested += OnAccountCommandsRequested;
}
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:7,代码来源:singlemicrosoftaccountscenario.xaml.cs
示例6: MainPageDelete
public virtual void MainPageDelete(MainPage entity)
{
TraceCallEnterEvent.Raise();
try
{
m_DataContext.BeginNestedTran();
try
{
m_DataContext.ndihdMainPageDelete(entity.ID);
m_DataContext.CommitNested();
}
catch
{
m_DataContext.RollbackNested();
throw;
}
TraceCallReturnEvent.Raise();
return;
}
catch (Exception ex)
{
ExceptionManager.Publish(ex);
TraceCallReturnEvent.Raise(false);
throw;
}
}
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:26,代码来源:MainPageServiceBase.cs
示例7: OnNavigatedTo
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
ResultCollection = new ObservableCollection<WiFiNetworkDisplay>();
rootPage = MainPage.Current;
// RequestAccessAsync must have been called at least once by the app before using the API
// Calling it multiple times is fine but not necessary
// RequestAccessAsync must be called from the UI thread
var access = await WiFiAdapter.RequestAccessAsync();
if (access != WiFiAccessStatus.Allowed)
{
rootPage.NotifyUser("Access denied", NotifyType.ErrorMessage);
}
else
{
DataContext = this;
var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector());
if (result.Count >= 1)
{
firstAdapter = await WiFiAdapter.FromIdAsync(result[0].Id);
RegisterButton.IsEnabled = true;
}
else
{
rootPage.NotifyUser("No WiFi Adapters detected on this machine", NotifyType.ErrorMessage);
}
}
}
开发者ID:t-angma,项目名称:Windows-universal-samples,代码行数:29,代码来源:scenario3_registerforupdates.xaml.cs
示例8: GameController
/// <summary>
/// Initializes a new instance of the <see cref="LabGame" /> class.
/// </summary>
public GameController(MainPage mainPage)
{
// Creates a graphics manager. This is mandatory.
graphicsDeviceManager = new GraphicsDeviceManager(this);
//Slider Values
// Setup the relative directory to the executable directory
// for loading contents with the ContentManager
Content.RootDirectory = "Content";
// Create the keyboard manager
keyboardManager = new KeyboardManager(this);
random = new Random();
input = new GameInput();
size = 10;
generateGhost = 0.99;
// Set boundaries.
boundaryNorth = 2.6f;
boundaryEast = size * 10 - 2.6f;
boundarySouth = size * 10 - 2.6f;
boundaryWest = 2.6f;
// Initialise event handling.
input.gestureRecognizer.Tapped += Tapped;
input.gestureRecognizer.ManipulationStarted += OnManipulationStarted;
input.gestureRecognizer.ManipulationUpdated += OnManipulationUpdated;
input.gestureRecognizer.ManipulationCompleted += OnManipulationCompleted;
this.mainPage = mainPage;
}
开发者ID:reeselevine,项目名称:proj2,代码行数:34,代码来源:GameController.cs
示例9: LoginButton_Click
private void LoginButton_Click(object sender, EventArgs e)
{
// mySQLconnection.Open();
/*
MySqlCommand mySQLcommand = new MySqlCommand("SELECT * FROM SUser WHERE username = @username AND password = @password");
if (this.OpenConnection() == true)
{
mySQLcommand.Parameters.AddWithValue("username", UsernameTextBox.Text);
mySQLcommand.Parameters.AddWithValue("password", PasswordTextBox.Text);
MySqlDataReader dataReader = mySQLcommand.ExecuteReader();
while(dataReader.Read())
{
mainpage = new MainPage();
mainpage.Show();
}
dataReader.Close();
}
//mainpage = new MainPage();
// mainpage.Show();
* */
DBConnect db = new DBConnect();
DataTable dataTable = db.GetUser(PasswordTextBox.Text, UsernameTextBox.Text);
if (dataTable != null)
{
mainpage = new MainPage();
mainpage.Show();
//MessageBox.Show(dataTable.ToString());
}
else MessageBox.Show("Noe gikk galt");
}
开发者ID:RosaRom,项目名称:systemutvikling,代码行数:33,代码来源:LoginForm.cs
示例10: MainPage
public MainPage()
{
this.InitializeComponent();
Current = this;
SampleTitle.Text = FEATURE_NAME;
}
开发者ID:Kinani,项目名称:TimelineMe-deprecated-,代码行数:7,代码来源:MainPage.xaml.cs
示例11: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
RootVisual = new MainPage
{
DataContext = new MainViewModel()
};
}
开发者ID:NALSS,项目名称:web_dashboard,代码行数:7,代码来源:App.xaml.cs
示例12: NewUserCreated_Click
private async void NewUserCreated_Click(object sender, RoutedEventArgs e)
{
Person p1 = new Person
{
name = NameInput2.Text,
pwd =PasswordInput2.Password,
g = g1,
ftb= ftb1,
mv=mv1,
disc=disc1,
csgo=csgo1,
age= AgeInput2.Text,
contactno=ContactInput2.Text
};
await App.MobileService.GetTable<Person>().InsertAsync(p1);
GlobalVar.Globalname = p1.name;
GlobalVar.Globalcontact = p1.contactno;
GlobalVar.Globalftb = p1.ftb;
GlobalVar.Globalmv = p1.mv;
GlobalVar.Globaldisc = p1.disc;
GlobalVar.Globalcsgo = p1.csgo;
GlobalVar.Globalg = p1.g;
GlobalVar.Globalage = p1.age;
//var m1 = new MessageDialog("Data Inserted").ShowAsync();
NameInput2.Text = "";
AgeInput2.Text = "";
ContactInput2.Text = "";
MainPage page = new MainPage();
this.Frame.Navigate(typeof(MainPage));
}
开发者ID:suhas2go,项目名称:projectX,代码行数:31,代码来源:SignUp.xaml.cs
示例13: OnNavigatedTo
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// Populate the list of users.
IReadOnlyList<User> users = await User.FindAllAsync();
var observableUsers = new ObservableCollection<UserViewModel>();
int userNumber = 1;
foreach (User user in users)
{
string displayName = (string)await user.GetPropertyAsync(KnownUserProperties.DisplayName);
// Choose a generic name if we do not have access to the actual name.
if (String.IsNullOrEmpty(displayName))
{
displayName = "User #" + userNumber.ToString();
userNumber++;
}
observableUsers.Add(new UserViewModel(user.NonRoamableId, displayName));
}
UserList.DataContext = observableUsers;
if (users.Count > 0)
{
UserList.SelectedIndex = 0;
}
}
开发者ID:nasa1992,项目名称:Windows-universal-samples,代码行数:26,代码来源:Scenario1_FindUsers.xaml.cs
示例14: OnNavigatedTo
/// <summary>
/// Upon entering the scenario, ensure that we have permissions to use the Microphone. This may entail popping up
/// a dialog to the user on Desktop systems. Only enable functionality once we've gained that permission in order to
/// prevent errors from occurring when using the SpeechRecognizer. If speech is not a primary input mechanism, developers
/// should consider disabling appropriate parts of the UI if the user does not have a recording device, or does not allow
/// audio input.
/// </summary>
/// <param name="e">Unused navigation parameters</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// Keep track of the UI thread dispatcher, as speech events will come in on a separate thread.
dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
// Prompt the user for permission to access the microphone. This request will only happen
// once, it will not re-prompt if the user rejects the permission.
bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();
if (permissionGained)
{
btnContinuousRecognize.IsEnabled = true;
PopulateLanguageDropdown();
await InitializeRecognizer(SpeechRecognizer.SystemSpeechLanguage);
}
else
{
this.dictationTextBox.Text = "Permission to access capture resources was not given by the user, reset the application setting in Settings->Privacy->Microphone.";
btnContinuousRecognize.IsEnabled = false;
cbLanguageSelection.IsEnabled = false;
}
}
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:33,代码来源:ContinuousDictationScenario.xaml.cs
示例15: OnNavigatedTo
/// <summary>
/// Upon entering the scenario, ensure that we have permissions to use the Microphone. This may entail popping up
/// a dialog to the user on Desktop systems. Only enable functionality once we've gained that permission in order to
/// prevent errors from occurring when using the SpeechRecognizer. If speech is not a primary input mechanism, developers
/// should consider disabling appropriate parts of the UI if the user does not have a recording device, or does not allow
/// audio input.
/// </summary>
/// <param name="e">Unused navigation parameters</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// Keep track of the UI thread dispatcher, as speech events will come in on a separate thread.
dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
// Prompt the user for permission to access the microphone. This request will only happen
// once, it will not re-prompt if the user rejects the permission.
bool permissionGained = await AudioCapturePermissions.RequestMicrophonePermission();
if (permissionGained)
{
btnContinuousRecognize.IsEnabled = true;
}
else
{
resultTextBlock.Text = "Permission to access capture resources was not given by the user, reset the application setting in Settings->Privacy->Microphone.";
}
Language speechLanguage = SpeechRecognizer.SystemSpeechLanguage;
string langTag = speechLanguage.LanguageTag;
speechContext = ResourceContext.GetForCurrentView();
speechContext.Languages = new string[] { langTag };
speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
PopulateLanguageDropdown();
// Initialize the recognizer. Since the recognizer is disposed on scenario exit, we need to make sure we re-initialize it on scenario
// entrance, as the xaml page may not get destroyed between openings of the scenario.
await InitializeRecognizer(SpeechRecognizer.SystemSpeechLanguage);
}
开发者ID:mhdubose,项目名称:Windows-universal-samples,代码行数:41,代码来源:ContinuousRecognitionSRGSConstraintScenario.xaml.cs
示例16: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
var protectionPolicyManager = ProtectionPolicyManager.GetForCurrentView();
protectionPolicyManager.Identity = ""; // personal context
InputTxtBox.Text = "Copy and paste this text to a non-enterprise app such as notepad";
}
开发者ID:ChSchmidt81,项目名称:Windows-universal-samples,代码行数:7,代码来源:Scenario8_ClipboardSource.xaml.cs
示例17: OnNavigatedTo
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
// Clear the messages
rootPage.NotifyUser(String.Empty, NotifyType.StatusMessage, true);
if (!ApplicationData.Current.RoamingSettings.Values.ContainsKey("DenyIfPhoneLocked"))
{
ApplicationData.Current.RoamingSettings.Values["DenyIfPhoneLocked"] = false;
}
if (!ApplicationData.Current.RoamingSettings.Values.ContainsKey("LaunchAboveLock"))
{
ApplicationData.Current.RoamingSettings.Values["LaunchAboveLock"] = false;
}
chkDenyIfPhoneLocked.IsChecked = (bool)ApplicationData.Current.RoamingSettings.Values["DenyIfPhoneLocked"];
chkLaunchAboveLock.IsChecked = (bool)ApplicationData.Current.RoamingSettings.Values["LaunchAboveLock"];
if (!(await CheckHceSupport()))
{
// No HCE support on this device
btnRegisterBgTask.IsEnabled = false;
btnAddCard.IsEnabled = false;
}
else
{
lstCards.ItemsSource = await SmartCardEmulator.GetAppletIdGroupRegistrationsAsync();
}
}
开发者ID:mhdubose,项目名称:Windows-universal-samples,代码行数:30,代码来源:ManageCard.xaml.cs
示例18: LoginToSite
public void LoginToSite()
{
var doc = XDocument.Load(@"P1\" + Settings.Default.P1DataFile);
XElement settings = doc.Document.Element("Tests").Element("settings");
XElement pageSettings = doc.Document.Element("Tests").Element("page");
string testName = pageSettings.Attribute("name").Value;
_driver = StartBrowser(settings.Attribute("browser").Value);
_baseUrl = settings.Attribute("baseURL").Value;
Trace.WriteLine(BasePage.RunningTestKeyWord + "'" + testName + "'");
Trace.WriteLine(BasePage.PreconditionsKeyWord);
MainPage mainPage = new MainPage(_driver);
mainPage.OpenUsingUrl(_baseUrl);
_loginPage = new LoginPage(_driver);
_loginPage.OpenUsingUrl(_baseUrl);
_loginPage.DoLoginUsingUrl("host", "dnnhost");
HostSettingsPage hostSettingsPage = new HostSettingsPage(_driver);
hostSettingsPage.OpenUsingButtons(_baseUrl);
hostSettingsPage.Click(By.XPath(HostSettingsPage.BasicSettingsTab));
_serverName = hostSettingsPage.FindElement(By.XPath(HostSettingsPage.HostName)).Text;
}
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:28,代码来源:P1ManageWebServers.cs
示例19: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.rootPage = e.Parameter as MainPage;
var hits = App.Data.Steps.Count(item => item.Answers.ToList().FindIndex(a => a.IsSelected) == item.CorrectAnswer - 1);
var misses = Constants.QuestionsCount - hits;
var percentageAnswered = (hits * 100) / Constants.QuestionsCount;
if (percentageAnswered == 0)
{
this.ResultsLegend.Text = Constants.LeaderboardMessage4;
}
else if (percentageAnswered == 100)
{
this.ResultsLegend.Text = Constants.LeaderboardMessage1;
}
else if (percentageAnswered <= 50)
{
this.ResultsLegend.Text = string.Format(Constants.LeaderboardMessage3, hits);
}
else
{
this.ResultsLegend.Text = string.Format(Constants.LeaderboardMessage2, hits);
}
this.SendResults(hits, misses);
}
开发者ID:mbin,项目名称:Win81App,代码行数:32,代码来源:ResultsPage.xaml.cs
示例20: MainPage
public MainPage()
{
Player.Instance = new Player();
Instance = this;
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
context = SynchronizationContext.Current;
viewManager = new ViewManager();
viewManager.Pivot = pivot;
commandBarManager = new CommandBarManager();
commandBarManager.CommandBar = commandBar;
commandBarManager.ButtonClick += feedViewControl.CommandBarButtonClick;
viewManager.ActiveViewChanged += feedViewControl.ActiveViewChanged;
viewManager.ActiveViewChanged += feedItemsViewControl.ActiveViewChanged;
feedViewControl.EnableButtons += commandBarManager.EnableButtons;
feedViewControl.ActivateView += viewManager.ActivateView;
feedItemsViewControl.EnableButtons += commandBarManager.EnableButtons;
feedItemsViewControl.ActivateView += viewManager.ActivateView;
feedItemsViewControl.Play += Player.Instance.Play;
SQLiteDb.Create();
viewManager.SwitchTo(PivotView.Feeds);
}
开发者ID:volthouse,项目名称:desktop,代码行数:33,代码来源:MainPage.xaml.cs
注:本文中的MainPage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论