本文整理汇总了C#中MainPage类的典型用法代码示例。如果您正苦于以下问题:C# MainPage类的具体用法?C# MainPage怎么用?C# MainPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainPage类属于命名空间,在下文中一共展示了MainPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
//Listen to AccountPictureChanged event
UserInformation.AccountPictureChanged += this.PictureChanged;
}
示例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);
}
示例4: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
activeAccount = (Account)e.Parameter;
//set inkCanvas size
rootPage = MainPage.Current;
this.SetGridSize();
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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");
}
示例10: MainPage
public MainPage()
{
this.InitializeComponent();
Current = this;
SampleTitle.Text = FEATURE_NAME;
}
示例11: Application_Startup
private void Application_Startup(object sender, StartupEventArgs e)
{
RootVisual = new MainPage
{
DataContext = new MainViewModel()
};
}
示例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));
}
示例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;
}
}
示例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;
}
}
示例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