private async void WebView_ScriptNotify(object sender, NotifyEventArgs e) { var messageArray = e.Value.Split(':'); string message, type; if (messageArray.Length > 1) { message = messageArray[1]; type = messageArray[0]; } else { message = e.Value; type = "typeAlert"; } var dialog = new Windows.UI.Popups.MessageDialog(message); if (type.Equals("typeConfirm")) { var cmd = new UICommandInvokedHandler(this.CommandInvokedHandler); dialog.Commands.Add(new UICommand("Yes", cmd)); dialog.Commands.Add(new UICommand("Cancel", cmd)); dialog.DefaultCommandIndex = 0; dialog.CancelCommandIndex = 1; } else if (type.Equals("typeLog")) { //Debug.WriteLine("type=" + type + " ,message=" + message); } var result = await dialog.ShowAsync(); }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); aboutCommand = new SettingsCommand("AboutId", "About / More Info", handler); eventArgs.Request.ApplicationCommands.Add(aboutCommand); }
public ResetPopup(Player[] player, Frame Mainpage, UICommandInvokedHandler resetMenu) { this._mainPage = Mainpage; this._player = player; string[] list = new string[_player.Length + 2]; for (int i = 0; i < _player.Length; i++) { list[i] = _player[i].Name + " Wins"; } list[_player.Length] = "Draw"; list[_player.Length + 1] = "Reset Score"; _pM = Class.CreateXAMLObj.CreatePopup(list); for (int i = 0; i < _player.Length+2; i++) { _pM.Commands[i].Invoked = resetMenu; } }
void CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand policyCommand = new SettingsCommand("policyCommand", "Privacy Policy", handler); args.Request.ApplicationCommands.Add(policyCommand); }
/// <summary> /// This event is generated when the user opens the settings pane. During this event, append your /// SettingsCommand objects to the available ApplicationCommands vector to make them available to the /// SettingsPange UI. /// </summary> /// <param name="settingsPane">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand generalCommand = new SettingsCommand("DefaultsId", "Defaults", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); }
void SettingsPane_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = OnSettingsPaneCommand; SettingsCommand privacyCommand = new SettingsCommand(Settings.Privacy, "Privacy Policy", handler); args.Request.ApplicationCommands.Add(privacyCommand); }
/// <summary> /// This event is generated when the user opens the settings pane. During this event, append your /// SettingsCommand objects to the available ApplicationCommands vector to make them available to the /// SettingsPange UI. /// </summary> /// <param name="settingsPane">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> private void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { var handler = new UICommandInvokedHandler(onSettingsCommand); var generalCommand = new SettingsCommand("ServerSettingsId", "Server Settings", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); }
private void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand settingsCommand = new SettingsCommand("ApressSettings", "Apress Demo Settings", handler); args.Request.ApplicationCommands.Add(settingsCommand); }
private async void Button_Tapped_1(object sender, TappedRoutedEventArgs e) { bool cleared = false; MessageDialog mBox = new MessageDialog("Selecting yes will clear all the air quality data stored by the app.", "Clear User Data"); var cmd = new UICommandInvokedHandler((command) => { var temp = command.Label; }); mBox.Commands.Add(new UICommand( "Yes", cmd)); mBox.Commands.Add(new UICommand( "No", cmd)); var returnCmd = await mBox.ShowAsync(); if (String.Equals(returnCmd.Label, "Yes")) cleared = await airDB.clear(); else return; if (cleared) { MessageDialog mBox2 = new MessageDialog("User Data Cleared", "User Data"); mBox2.ShowAsync(); } else { MessageDialog mBox2 = new MessageDialog("Failed to Clear User Data (there may be none to clear)", "User Data"); mBox2.ShowAsync(); } }
private static void AddButtons( MessageDialog messageDialog, MessageBoxButtons messageBoxButtons, UICommandInvokedHandler positiveHandler, UICommandInvokedHandler negativeHandler) { if ((messageBoxButtons & MessageBoxButtons.Ok) == MessageBoxButtons.Ok) { messageDialog.Commands.Add(new UICommand("OK", positiveHandler)); } if ((messageBoxButtons & MessageBoxButtons.Cancel) == MessageBoxButtons.Cancel) { messageDialog.Commands.Add(new UICommand("Cancel", negativeHandler)); } if ((messageBoxButtons & MessageBoxButtons.Yes) == MessageBoxButtons.Yes) { messageDialog.Commands.Add(new UICommand("Yes", positiveHandler)); } if ((messageBoxButtons & MessageBoxButtons.No) == MessageBoxButtons.No) { messageDialog.Commands.Add(new UICommand("No", negativeHandler)); } }
private void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler invokedHandler = new UICommandInvokedHandler(AboutInvokeHandler); SettingsCommand aboutCommand = new SettingsCommand("About", "About Jimmy's Comics", invokedHandler); args.Request.ApplicationCommands.Add(aboutCommand); }
void AircraftsPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler invokeHandler = new UICommandInvokedHandler(AboutInvokeHandler); SettingsCommand aboutCommand = new SettingsCommand("About", "About Invaders", invokeHandler); args.Request.ApplicationCommands.Add(aboutCommand); }
// TODO : Use custom Content Dialog to allow styling of the application public async Task <DialogResult> ShowAsync(PermissionResult message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } var dialog = new MessageDialog(message.LocalizationKeyName); UICommandInvokedHandler empty = cmd => { }; switch (message.Type) { case PermissionType.Allow: break; case PermissionType.Confirm: dialog.Commands.Add(new UICommand(@"Accept", empty, DialogResult.Accept)); dialog.Commands.Add(new UICommand(@"Decline", empty, DialogResult.Decline)); dialog.Commands.Add(new UICommand(@"Cancel", empty, DialogResult.Cancel)); break; case PermissionType.Deny: dialog.Commands.Add(new UICommand(@"OK", empty, DialogResult.Cancel)); break; default: throw new ArgumentOutOfRangeException(); } var task = dialog.ShowAsync().AsTask(); var result = await task; return((DialogResult)result.Id); }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand privacyPolicyCommand = new SettingsCommand(Constants.PrivacyPolicyId, Constants.PrivacyPolicy, handler); eventArgs.Request.ApplicationCommands.Add(privacyPolicyCommand); }
public AppSettingsBar(List<string> desiredSettingCommands, UICommandInvokedHandler uicih) { _settingCommands = new List<SettingsCommand>(); foreach (string name in desiredSettingCommands) { _settingCommands.Add(new SettingsCommand(name, name, uicih)); } }
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler invokedHandler = new UICommandInvokedHandler(AboutInvokedHandler); SettingsCommand aboutCommand = new SettingsCommand("About", "About Jimmy's Comics", invokedHandler); args.Request.ApplicationCommands.Add(aboutCommand); }
/// <summary> /// This event is generated when the user opens the settings pane. During this event, append your /// SettingsCommand objects to the available ApplicationCommands vector to make them available to the /// SettingsPange UI. /// </summary> /// <param name="settingsPane">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> private void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = OnSettingsCommand; var generalCommand = new SettingsCommand("SettingsId", "Bandwidth Settings", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); }
private void settingsPane_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var ConfigHandler = new UICommandInvokedHandler(onConfigCommand); var loader = new ResourceLoader(); var configurationCommand = new SettingsCommand(loader.GetString("Settings"), loader.GetString("Settings"), ConfigHandler); args.Request.ApplicationCommands.Add(configurationCommand); }
public AppSettingsBar(List <string> desiredSettingCommands, UICommandInvokedHandler uicih) { _settingCommands = new List <SettingsCommand>(); foreach (string name in desiredSettingCommands) { _settingCommands.Add(new SettingsCommand(name, name, uicih)); } }
void settingsPane_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var commandHandler = new UICommandInvokedHandler(this.OnSettingsCommand); var generalSettingsCommand = new SettingsCommand("acc", "Account", commandHandler); args.Request.ApplicationCommands.Add(generalSettingsCommand); }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand authenticateCommand = new SettingsCommand("auth", "Admin", handler); eventArgs.Request.ApplicationCommands.Clear(); eventArgs.Request.ApplicationCommands.Add(authenticateCommand); }
private async Task ShowDialog(string message, UICommandInvokedHandler yesHandler) { var dialog = new MessageDialog(message); dialog.Commands.Add(new UICommand(resources.GetString("Dialog_Yes"), yesHandler)); dialog.Commands.Add(new UICommand(resources.GetString("Dialog_No"))); await dialog.ShowAsync(); }
/// <summary> /// This event is generated when the user clicks on Accounts command in settings pane. During this event, add your /// WebAccountProviderCommand, WebAccountCommand, CredentialCommand and SettingsCommand objects to make them available to the /// AccountsSettingsPane UI. /// </summary> /// <param name="accountsSettingsPane">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> private void AccountCommandsRequested(AccountsSettingsPane accountsSettingsPane, AccountsSettingsPaneCommandsRequestedEventArgs eventArgs) { var deferral = eventArgs.GetDeferral(); //Add header text. eventArgs.HeaderText = "This is sample text. You can put a message here to give context to user. This section is optional."; //Add WebAccountProviders WebAccountProviderCommandInvokedHandler providerCmdHandler = new WebAccountProviderCommandInvokedHandler(WebAccountProviderInvokedHandler); WebAccountProviderCommand facebookProviderCommand = new WebAccountProviderCommand(facebookProvider, WebAccountProviderInvokedHandler); eventArgs.WebAccountProviderCommands.Add(facebookProviderCommand); WebAccountProviderCommand twitterProviderCommand = new WebAccountProviderCommand(twitterProvider, WebAccountProviderInvokedHandler); eventArgs.WebAccountProviderCommands.Add(twitterProviderCommand); //Add WebAccounts if available. WebAccountCommandInvokedHandler accountCmdHandler = new WebAccountCommandInvokedHandler(WebAccountInvokedHandler); if (isFacebookUserLoggedIn) { facebookAccount = new WebAccount(facebookProvider, facebookUserName, WebAccountState.Connected); WebAccountCommand facebookAccountCommand = new WebAccountCommand( facebookAccount, WebAccountInvokedHandler, SupportedWebAccountActions.Remove | SupportedWebAccountActions.Manage); eventArgs.WebAccountCommands.Add(facebookAccountCommand); } if (isTwitterUserLoggedIn) { twitterAccount = new WebAccount(twitterProvider, twitterUserName, WebAccountState.Connected); WebAccountCommand twitterAccountCommand = new WebAccountCommand( twitterAccount, WebAccountInvokedHandler, SupportedWebAccountActions.Remove | SupportedWebAccountActions.Manage); eventArgs.WebAccountCommands.Add(twitterAccountCommand); } // Add links if needed. Object commandID = 1; UICommandInvokedHandler globalLinkInvokedHandler = new UICommandInvokedHandler(GlobalLinkInvokedhandler); SettingsCommand command = new SettingsCommand( commandID, "More details", globalLinkInvokedHandler); eventArgs.Commands.Add(command); SettingsCommand command1 = new SettingsCommand( commandID, "Privacy policy", globalLinkInvokedHandler); eventArgs.Commands.Add(command1); deferral.Complete(); }
public static IAsyncOperation <IUICommand> ShowWarningDialogAsync(UICommandInvokedHandler Callback) { MessageDialog MessageBox = new MessageDialog("Вы уверены, что хотите прододолжить?", "Внимание!"); MessageBox.Commands.Add(new UICommand("Продолжить", Callback)); MessageBox.Commands.Add(new UICommand("Отмена")); MessageBox.CancelCommandIndex = 1; MessageBox.DefaultCommandIndex = 1; return(MessageBox.ShowAsync()); }
/// <summary> /// Services event called in settings pane - CommandsRequested /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void InvadersPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { // Create new delegate type object UICommandInvokedHandler invokedHandler = AboutInvokedHandler; // Create new settings command SettingsCommand aboutCommand = new SettingsCommand("About", "About", invokedHandler); // Add new command args.Request.ApplicationCommands.Add(aboutCommand); }
/// <summary> /// Adds the settings command. /// </summary> /// <param name="id">The id.</param> /// <param name="label">The label.</param> /// <param name="handler">The handler.</param> /// <param name="args">The <see cref="SettingsPaneCommandsRequestedEventArgs" /> instance containing the event data.</param> protected void AddSettingsCommand(string id, string label, UICommandInvokedHandler handler, SettingsPaneCommandsRequestedEventArgs args) { if (!args.Request.ApplicationCommands.Any(x => x.Id is string && (string) x.Id == id)) { var command = new SettingsCommand(id,label, handler); args.Request.ApplicationCommands.Add(command); } }
private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand privacy1Command = new SettingsCommand("privacystatementPage", "Privacy statement", handler); args.Request.ApplicationCommands.Add(privacy1Command); }
private void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand cmd2 = new SettingsCommand("ID_2", "Privacy", handler); args.Request.ApplicationCommands.Add(cmd2); SettingsCommand cmd3 = new SettingsCommand("ID_3", "Support", handler); args.Request.ApplicationCommands.Add(cmd3); }
/// <summary> /// Método que será executado quando o usuário clicar na opção configuração (Setting) no Charm /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void AppBox_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { //definindo a função que será executada UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); //Criando o objeto SettingsCommand com a função que será executada. SettingsCommand aboutCommand = new SettingsCommand("aboutSettings", "Sobre", handler); //Incluindo o objeto na listad de comandos da aplicação. args.Request.ApplicationCommands.Add(aboutCommand); }
private void OnCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var aboutCommandHandler = new UICommandInvokedHandler(OnAboutCommandInvoker); var aboutPage = new SettingsCommand("aboutPage", "About", aboutCommandHandler); var settingsCommandHandler = new UICommandInvokedHandler(OnSettingsCommandInvoker); var settingsPage = new SettingsCommand("settingsPage", "Settings", settingsCommandHandler); args.Request.ApplicationCommands.Add(aboutPage); args.Request.ApplicationCommands.Add(settingsPage); }
/// <summary> /// Creates a new instance of the UICommand class using the specified label, and optional event handler and command identifier. /// </summary> /// <param name="label"></param> /// <param name="action"></param> /// <param name="id"></param> public UICommand(string label, UICommandInvokedHandler action, object id) { if (label == null) { throw new ArgumentNullException(nameof(label)); } Label = label; // These can be null Invoked = action; Id = id; }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand generalCommand = new SettingsCommand("generalSettings", "General", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); SettingsCommand helpCommand = new SettingsCommand("helpPage", "Help", handler); eventArgs.Request.ApplicationCommands.Add(helpCommand); }
public static async void ShowMessageDialog(string title, string content, UICommandInvokedHandler yesUICommandInvokedHandler , UICommandInvokedHandler noUICommandInvokedHandler) { var messageDialog = new MessageDialog(content) { Title = title }; messageDialog.Commands.Add(new UICommand("确定", yesUICommandInvokedHandler)); messageDialog.Commands.Add(new UICommand("取消", noUICommandInvokedHandler)); await messageDialog.ShowAsync(); }
/// <summary> /// Creates a confirm prompt for the user /// </summary> /// <param name="prompt"></param> /// <param name="title"></param> /// <param name="yes"></param> /// <param name="no"></param> /// <returns></returns> public static async Task <IUICommand> Confirm(string prompt, string title, UICommandInvokedHandler yes, UICommandInvokedHandler no) { var msg = new MessageDialog(prompt, title); //, async (ap) => { }) msg.Commands.Add(new UICommand("Yes", yes, 1)); msg.Commands.Add(new UICommand("No", no, 2)); msg.DefaultCommandIndex = 1; return(await msg.ShowAsync()); }
private void Settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler accountSettingshandler = new UICommandInvokedHandler(onAccountSettingsCommand); SettingsCommand accountSettingsCommand = new SettingsCommand("ApressAccountSettings", "Account", accountSettingshandler); args.Request.ApplicationCommands.Add(accountSettingsCommand); UICommandInvokedHandler privacySettingshandler = new UICommandInvokedHandler(onPrivacySettingsCommand); SettingsCommand privacySettingsCommand = new SettingsCommand("ApressPrivacySettings", "Privacy Statement", privacySettingshandler); args.Request.ApplicationCommands.Add(privacySettingsCommand); }
protected override void OnWindowCreated(WindowCreatedEventArgs args) { base.OnWindowCreated(args); SettingsPane.GetForCurrentView().CommandsRequested += delegate(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand); SettingsCommand generalCommand = new SettingsCommand("AccountsId", "Account", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); }; }
public async static Task Soru(string mesaj, UICommandInvokedHandler yesHand) { try { var msj = new MessageDialog(mesaj, "O mu Bu mu"); msj.Commands.Add(new UICommand("Evet", yesHand)); msj.Commands.Add(new UICommand("Hayır", (sndr) => { })); msj.CancelCommandIndex = 1; msj.DefaultCommandIndex = 1; await msj.ShowAsync(); } catch { } }
void App_CommandsRequested(Windows.UI.ApplicationSettings.SettingsPane sender, Windows.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand aboutCommand = new SettingsCommand("about", "关于", handler); args.Request.ApplicationCommands.Add(aboutCommand); SettingsCommand cacheCommand = new SettingsCommand("clearcache", "清空缓存", handler); args.Request.ApplicationCommands.Add(cacheCommand); SettingsCommand privacyPolicyCommand = new SettingsCommand("privacypolicy", "隐私声明", handler); args.Request.ApplicationCommands.Add(privacyPolicyCommand); }
public static async void OpenMessageDialog(string content, string title, string buttonLabel, string buttonLabel2, UICommandInvokedHandler CommandInvokedHandler) { try { var messageDialog = new MessageDialog(content, title); messageDialog.Commands.Add(new UICommand(buttonLabel, CommandInvokedHandler)); if (!string.IsNullOrEmpty(buttonLabel2)) messageDialog.Commands.Add(new UICommand(buttonLabel2, CommandInvokedHandler)); await messageDialog.ShowAsync(); } catch { } }
private void settingsPane_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { var ConfigHandler = new UICommandInvokedHandler(onConfigCommand); var LogoutHandler = new UICommandInvokedHandler(onLogoutCommand); var loader = new ResourceLoader(); var configurationCommand = new SettingsCommand(loader.GetString("Settings"), loader.GetString("Settings"), ConfigHandler); args.Request.ApplicationCommands.Add(configurationCommand); if (!string.IsNullOrEmpty(ConnectedService.LoggedInUser)) { var logoutCommand = new SettingsCommand(loader.GetString("Logout"), loader.GetString("Logout"), onLogoutCommand); args.Request.ApplicationCommands.Add(logoutCommand); } }
public void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); var logoutLabel = loader.GetString("LogOut"); var privacyLabel = loader.GetString("PrivacyPolicy"); UICommandInvokedHandler logoutHandler = new UICommandInvokedHandler(onLogoutCommand); UICommandInvokedHandler privacyHandler = new UICommandInvokedHandler(onPrivacyCommand); SettingsCommand logoutCommand = new SettingsCommand("LogoutId", logoutLabel, logoutHandler); SettingsCommand privacyCommand = new SettingsCommand("PrivacyId", privacyLabel, privacyHandler); eventArgs.Request.ApplicationCommands.Add(logoutCommand); eventArgs.Request.ApplicationCommands.Add(privacyCommand); }
public static async void UserChoice(string message, string confirmButtonLabel, string rejectButtonLabel, UICommandInvokedHandler handler) { var messageDialog = new MessageDialog(message); messageDialog.Commands.Add(new UICommand( confirmButtonLabel, handler)); messageDialog.Commands.Add(new UICommand( rejectButtonLabel, handler)); messageDialog.DefaultCommandIndex = 0; messageDialog.CancelCommandIndex = 1; await messageDialog.ShowAsync(); }
public static async void ShowYesNoDialog(string message, UICommandInvokedHandler invokeHandler) { var messageDialog = new MessageDialog(message); messageDialog.Commands.Add(new UICommand( "Ja", new UICommandInvokedHandler(invokeHandler))); messageDialog.Commands.Add(new UICommand( "Nein", new UICommandInvokedHandler(invokeHandler))); messageDialog.DefaultCommandIndex = 0; messageDialog.CancelCommandIndex = 1; await messageDialog.ShowAsync(); }
/// <summary> /// Display a dialog box with a custom action when the user presses "OK" /// </summary> /// <param name="dispatcher">UI thread's dispatcher</param> /// <param name="content">Message box content</param> /// <param name="title">Message box title</param> /// <param name="okHandler">Callback executed when the user presses "OK"</param> public static void DisplayDialog(CoreDispatcher dispatcher, string content, string title, UICommandInvokedHandler okHandler) { Debug.WriteLine("Dialog requested: " + title + " - " + content); var unused = dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { var dialog = new MessageDialog(content, title); if (okHandler != null) { dialog.Commands.Add(new UICommand("OK", okHandler)); } else { dialog.Commands.Add(new UICommand("OK")); } dialog.DefaultCommandIndex = 0; dialog.CancelCommandIndex = 0; await dialog.ShowAsync(); }); }
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { try { // Callback invoked to request the app for setting commands when the settings flyout is about to be displayed //Add Custom commands UICommandInvokedHandler handler = new UICommandInvokedHandler(bla); SettingsCommand generalCommand = new SettingsCommand( "generalSettings", "General", handler); args.Request.ApplicationCommands.Add(generalCommand); SettingsCommand helpCommand = new SettingsCommand("helpPage", "Help", handler); args.Request.ApplicationCommands.Add(helpCommand); args.Request.ApplicationCommands.Add(SettingsCommand.AccountsCommand); //This will show the “Accounts” command when the “Settings” pane is displayed } catch (Exception Error) // No stored credentials, so none to delete { DebugPrint(Error.Message); } }
/// <summary> /// 최종 사용자가 응용 프로그램을 정상적으로 시작할 때 호출됩니다. 다른 진입점은 /// 특정 파일을 열거나, 검색 결과를 표시하는 등 응용 프로그램을 시작할 때 /// 사용됩니다. /// </summary> /// <param name="args">시작 요청 및 프로세스에 대한 정보입니다.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { Frame rootFrame = Window.Current.Content as Frame; // 창에 콘텐츠가 이미 있는 경우 앱 초기화를 반복하지 말고, // 창이 활성화되어 있는지 확인하십시오. if (rootFrame == null) { // 탐색 컨텍스트로 사용할 프레임을 만들고 첫 페이지로 이동합니다. rootFrame = new Frame(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 이전에 일시 중지된 응용 프로그램에서 상태를 로드합니다. } // 현재 창에 프레임 넣기 Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // 탐색 스택이 복원되지 않으면 첫 번째 페이지로 돌아가고 // 필요한 정보를 탐색 매개 변수로 전달하여 새 페이지를 // 구성합니다. if (!rootFrame.Navigate(typeof(MainPage), args.Arguments)) { throw new Exception("Failed to create initial page"); } } // 현재 창이 활성 창인지 확인 Window.Current.Activate(); SettingsPane.GetForCurrentView().CommandsRequested += (SettingsPane sender, SettingsPaneCommandsRequestedEventArgs e) => { UICommandInvokedHandler handler = new UICommandInvokedHandler( async (IUICommand command) => { string pdm = await FileIO.ReadTextAsync(await Package.Current.InstalledLocation.GetFileAsync("Data\\PersonalDataManagement.txt")); await MessageBox.ShowAsync(pdm, "랑트랜스 개인정보 취급방침(Privacy policy)", MessageBoxButton.OK); }); SettingsCommand generalCommand = new SettingsCommand("Privacy Policy", "개인 정보 정책(Privacy Policy)", handler); e.Request.ApplicationCommands.Add(generalCommand); }; }
void CodeEditor_CommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { //throw new NotImplementedException(); UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand generalCommand = new SettingsCommand("generalSettings", "General", handler); eventArgs.Request.ApplicationCommands.Add(generalCommand); }
/// <summary> /// Initializes a new instance of the UICommand class, using the specified label, event handler, and command identifier. /// </summary> /// <param name="label">The label for the new command.</param> /// <param name="action">The event handler for the new command.</param> /// <param name="commandId">The command identifier for the new command.</param> public UICommand(string label, UICommandInvokedHandler action, object commandId) : this(label, action) { Id = commandId; }
/// <summary> /// Initializes a new instance of the UICommand class, using the specified label and event handler. /// </summary> /// <param name="label">The label for the new command.</param> /// <param name="action">The event handler for the new command. </param> public UICommand(string label, UICommandInvokedHandler action) { Label = label; Invoked = action; }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand); SettingsCommand aboutCommand = new SettingsCommand("about", "About", handler); eventArgs.Request.ApplicationCommands.Add(aboutCommand); SettingsCommand policyCommand = new SettingsCommand("privacyPolicy", "Privacy Policy", handler); eventArgs.Request.ApplicationCommands.Add(policyCommand); }
void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand aboutCommand = new SettingsCommand("AU", "About Us", handler); args.Request.ApplicationCommands.Add(aboutCommand); //SettingsCommand contactCommand = new SettingsCommand("CU", "Contact Us", handler); //args.Request.ApplicationCommands.Add(contactCommand); //SettingsCommand privacyCommand = new SettingsCommand("PP", "Privacy Policy", handler); //args.Request.ApplicationCommands.Add(privacyCommand); //SettingsCommand termsCommand = new SettingsCommand("TC", "Terms and Conditions", handler); //args.Request.ApplicationCommands.Add(termsCommand); }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); SettingsCommand languageCommand = new SettingsCommand("languagePage", Utils.Constants.ResourceLoader.GetString("Languages"), handler); eventArgs.Request.ApplicationCommands.Add(languageCommand); SettingsCommand helpCommand = new SettingsCommand("helpPage", Utils.Constants.ResourceLoader.GetString("Help"), handler); eventArgs.Request.ApplicationCommands.Add(helpCommand); SettingsCommand feedbackCommand = new SettingsCommand("feedbackpage", Utils.Constants.ResourceLoader.GetString("AboutUsAndFeedbak"), handler); eventArgs.Request.ApplicationCommands.Add(feedbackCommand); SettingsCommand tellfriendCommand = new SettingsCommand("tellfriendpage", Utils.Constants.ResourceLoader.GetString("TellToFriends"), handler); eventArgs.Request.ApplicationCommands.Add(tellfriendCommand); SettingsCommand privacypolicyCommand = new SettingsCommand("privacypolicy", Utils.Constants.ResourceLoader.GetString("PrivacyPolicy"), handler); eventArgs.Request.ApplicationCommands.Add(privacypolicyCommand); }
void OnCommandsRequested( SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { // Preparamos el metodo que se llamará cuando el usuario pulse // en alguno de los Settings UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand); // Hacemos que las diferentes opciones aparezcan en los Settings // Política de privacidad var loader = new Windows.ApplicationModel.Resources.ResourceLoader(); string privacyStatement = loader.GetString("Privacy"); SettingsCommand privacyPolicyCommand = new SettingsCommand("politicaPrivacidad", privacyStatement, handler); eventArgs.Request.ApplicationCommands.Add(privacyPolicyCommand); // Contacta con nosotros string contactUs = loader.GetString("ContactUs"); SettingsCommand contactUsCommand = new SettingsCommand("contactaConNosotros", contactUs, handler); eventArgs.Request.ApplicationCommands.Add(contactUsCommand); }
void onCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs eventArgs) { //表示处理在用户调用上下文菜单命令时引发的事件的回调函数。 UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand); //创建表示设置项的设置命令对象。此设置命令可追加到 ApplicationCommands 矢量。 SettingsCommand privacyStatement = new SettingsCommand("privacyStatement", "隐私政策", handler); //追加 SettingsCommand 对象,使这些对象可供 SettingsPane UI 使用。 eventArgs.Request.ApplicationCommands.Add(privacyStatement); }
private async void OnAskToUnPauseGame(GameboardCardSetItem selectedMatchItem) { var yesSelected = false; var dialog = new MessageDialog("The board is currently paused, would you like to start playing now?"); var yesHandler = new UICommandInvokedHandler(cmd => { yesSelected = true; }); dialog.Commands.Add(new UICommand("Yes", yesHandler)); dialog.Commands.Add(new UICommand("No")); await dialog.ShowAsync(); if (yesSelected) { Play(); GameCardSelected(selectedMatchItem); } }