public void Show(string caption, string message, DialogType type, bool showOk, bool showCancel, Action<bool> closeAction) { var dialog = new Dialog(showCancel, type) {Caption = caption, Message = message, CloseAction = closeAction}; dialog.Closed += new EventHandler(OnDialogClosed); ParentGrid.Children.Add(dialog); dialog.Show(); }
internal DialogResponse ShowMessage(string message, string header, DialogType dialogueType, Window owner) { Owner = owner; DataTemplate figureTemplate = null; switch (dialogueType) { case DialogType.Message: figureTemplate = Application.Current.TryFindResource("InformationTemplate") as DataTemplate; btnCancel.Visibility = btnYes.Visibility = btnNo.Visibility = Visibility.Collapsed; break; case DialogType.Error: figureTemplate = Application.Current.TryFindResource("ErrorTemplate") as DataTemplate; btnCancel.Visibility = btnYes.Visibility = btnNo.Visibility = Visibility.Collapsed; break; case DialogType.Question: figureTemplate = Application.Current.TryFindResource("IterrogationTemplate") as DataTemplate; btnCancel.Visibility = btnOk.Visibility = Visibility.Collapsed; break; case DialogType.QuestionWithCancel: figureTemplate = Application.Current.TryFindResource("IterrogationTemplate") as DataTemplate; btnOk.Visibility = Visibility.Collapsed; break; } if (null != figureTemplate) imageShower.ContentTemplate = figureTemplate; txtHeader.Text = header; txtBody.Text = message; ShowDialog(); return _response; }
public DialogContext(DialogType type, IApplicationLicenseKey key, ILicenseProfile profile) { this.Key = key; this.Profile = profile; switch (type) { case DialogType.Steam: this.Content = new AddSteamKey(); break; case DialogType.UserNamePassword: this.Content = new AddSteamKey(false); break; case DialogType.Executable: case DialogType.Process: this.Content = new AddProcessKey(); break; case DialogType.Registry: this.Content = new AddRegistryKey(); break; case DialogType.RegistryImport: this.Content = new RegistryImportKey(); break; default: break; } }
public void RemoveDialog(DialogType type) { if (this.DialogExist(type)) { this.dialogs.Remove(type); } }
private void ExecuteDialogSlapdown(IDialogMonitor dialogMonitor, DialogType dialogType) { Action<string> a = msg => { if (msg.Contains("836D4425-DB59-48BB-BA7B-03AB20A57499")) { _eventPublisher .SendMessage(new FatalSilverlightExceptionServerEvent(dialogType) { Message = msg, }); _eventPublisher .SendMessage<TestRunCompletedServerEvent>(); } else { _eventPublisher.SendMessage( new DialogAssertionServerEvent(dialogType) { Message = msg, }); } }; dialogMonitor.ExecuteDialogSlapDown(a); }
public static void OpenMenu(Character target, MapObject source, uint dialogScript, DialogType type, params DialogType[] icons) { byte[] dialogs = new byte[icons.Length]; for (int i = 0; i < icons.Length; i++) dialogs[i] = (byte)icons[i]; OpenMenu(target, source, dialogScript, type, dialogs); }
public AuthenticationDialog(DialogType dialogType) { InitializeComponent(); base.Loaded += OnLoaded; SignInUserName = (App.Model.UserServices.LastUserName != null ? App.Model.UserServices.LastUserName : ""); switch (dialogType) { case DialogType.SignIn: OnSwitchToSignInPanelClick(null, null); break; case DialogType.Register: OnSwitchToRegisterPanelClick(null, null); break; case DialogType.RecoverSignIn: OnSwitchToRecoverPanelClick(null, null); break; case DialogType.ResetPassword: OnSwitchToResetPasswordPanelClick(null, null); break; case DialogType.ChangePassword: OnSwitchToChangePanelClick(null, null); break; case DialogType.DeleteAccount: OnSwitchToDeletePanelClick(null, null); break; } // m_FocusControl set during initialization above InitializeDialogPanel(true/*bModal*/, m_FocusControl); }
/// <summary> /// Creates an instance of the class /// </summary> /// <param name="type">dialog type</param> /// <param name="suppressed">dialog want not shown</param> /// <param name="modal">dialog want shown as modal to its parent</param> /// <param name="arguments">arguments dependent on dialog type</param> internal DialogShowEventArgs(DialogType type, bool suppressed, bool modal, IEnumerable<KeyValuePair<string, object>> arguments) { Type = type; Suppressed = suppressed; Modal = modal; Arguments = null != arguments ? arguments : new List<KeyValuePair<string, object>>(); }
/// <exclude /> public MessageBoxActionToken(string title, string message, DialogType dialogType, List<PermissionType> permissionTypes) { _permissionTypes = permissionTypes; this.Title = title; this.Message = message; this.DialogType = dialogType; }
public ListChildInfoDialog(int selectedListFamilyId) : this() { dialogType = DialogType.Add; this.selectedListFamilyId = selectedListFamilyId; this.chkNeverEnd.IsChecked = true; }
public void ShowDialog(object dialog, DialogType type, InteractionState? interactionState = null) { var dialogHost = Screen as IIsDialogHost; var revert = ChangeMode(interactionState); if (dialogHost == null) { Dialog = dialog; } else { dialogHost.AddDialog(dialog, type); } ((IClosable) dialog).Closed += delegate { if (dialogHost == null) { Dialog = null; } else { dialogHost.RemoveDialog(dialog); } ChangeMode(revert); }; }
/// <summary> /// 将游戏打包成ios或Android 后运行的,打包成assetbundle /// </summary> /// <param name="type"></param> /// <returns></returns> private IEnumerator OnCreatePanel(DialogType type) { path = Util.AppContentDataUri + "UI/" + type.ToString() + "Panel.unity3d"; GameObject go = null; WWW bundle = new WWW(path); yield return bundle; //等待加载完成后进行其他操作 try { if (bundle.assetBundle.Contains(type.ToString()+"Panel")) { go = Instantiate(bundle.assetBundle.LoadAsset(type.ToString() + "Panel", typeof (GameObject))) as GameObject; } } catch (Exception e) { Debug.Log(e.ToString()); } go.name = type.ToString() + "Panel"; go.transform.parent = UIContainer.instance.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; bundle.assetBundle.Unload(false); //加载完成后卸载 }
/// <summary> /// Styles the Dialog Box (Components Visibility etc.) according to the dialog box type /// </summary> /// <param name="dt">Enumerated type - Dialog Type</param> private void StyleDialogBox(DialogType dt) { switch (dt) { case DialogType.Error: Title = "Error"; OkCommandPanel.Visibility = Visibility.Visible; break; case DialogType.Warning: Title = "Warning"; OkCancelCommandPanel.Visibility = Visibility.Visible; break; case DialogType.Information: Title = "Information"; OkCommandPanel.Visibility = Visibility.Visible; break; case DialogType.Indeterminate: CannotBeClosed = true; Title = (string) LblCaption.Content; ProgressBarTermination.IsEnabled = true; ProgressBarTermination.Visibility = Visibility.Visible; MinimizePanel.Visibility = Visibility.Visible; break; } // Gets the approriate image type to show besides dialog message ImgIcon.Source = GetSystemImage(dt); }
private bool _closingAnimationNotCompleted = true; // status of whether closing animation is complete /// <summary> /// Initializes the DialogWindow /// </summary> /// <param name="parentWindow">Reference to the parent window</param> /// <param name="caption">Caption to Show in Dialog Box</param> /// <param name="message">Message to Show in Dialog Box</param> /// <param name="dt">Enumerated type - DialogType</param> public DialogWindow(Window parentWindow, string caption, string message, DialogType dt) { InitializeComponent(); // Resets Choice for Warning DialogBoxType Application.Current.Properties["DialogWindowChoice"] = false; // Sets up window properties for Indeterminate Dialog Box Type try { if (dt != DialogType.Indeterminate) { ShowInTaskbar = false; Owner = parentWindow; CannotBeClosed = false; } else { CannotBeClosed = true; } } catch (InvalidOperationException) { } // Sets the caption & message of the Dialog Box LblCaption.Content = caption; TxtBlkMessageBoxText.Text = message; // Styles the Dialog Box StyleDialogBox(dt); PlayDialogSound(dt); }
public ListFamilyInfoDialog(ListFamily listFamily) { InitializeComponent(); dialogType = DialogType.Edit; this.listFamily = listFamily; this.tbListFamilyTitle.Text = listFamily.Title; this.tbListFamilyDetail.Text = listFamily.Detail; }
public static void AcknowledgeMenuPressed(Character target, DialogType button, byte menu) { SMSG_NPCMENU spkt = new SMSG_NPCMENU(); spkt.ButtonID = (byte)button; spkt.MenuID = menu; spkt.SessionId = target.id; target.client.Send((byte[])spkt); }
public void LoadDialog(DialogType type) { if (spriteRenderer != null) { spriteRenderer.sprite = AssetCatalog.instance.dialogs.GetByName("Dialog"+type); transform.localScale=Vector3.zero; transform.DOScale(startScale, 2f).SetEase(Ease.OutElastic); transform.DOPunchPosition(transform.up, 0.1f); } }
public Dialog(bool allowCancel, DialogType dialogType) : this() { CancelButton.Visibility = allowCancel ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; SetImage(dialogType); }
/// <summary> /// 根据类型增加对话框 /// </summary> /// <param name="type"></param> /// <returns></returns> public DialogInfo AddDialog(DialogType type) { DialogInfo dialogInfo = new DialogInfo(); dialogInfo.Type = type; this.dialogs.Add(type,dialogInfo); return dialogInfo; }
public CreateEditResearchWindow(DialogType dt, ResearchType rt) { dType = dt; rType = rt; InitializeComponent(); InitializeTexts(); }
public ViewModel(string message, string title, MessageBoxButton buttons, DialogType dialogType = DialogType.Large, MessageBoxImage icon = MessageBoxImage.Question) { Message = message; Title = title; DialogType = dialogType; Buttons = buttons; Icon = GetIconName(icon); }
/// <summary> /// Default Constructor that initializes this form /// </summary> /// <param name="type">Type of this form</param> /// <param name="buttons">Buttons to show for user</param> /// <param name="title">Title of this form</param> /// <param name="message">Message to show for user</param> public DialogForm( DialogType type, DialogButtons buttons, string title, string message ) { InitializeComponent(); this.Title = title; this.txtMessage.Text = message; ConfigureButtons( buttons ); ConfigureIcon( type ); }
public IScheduleViewDialogHost CreateNew(ScheduleViewBase scheduleView, DialogType dialogType) { var dialogHost = this.DialogHost; dialogHost.Content = new SchedulerDialog(); dialogHost.ScheduleView = scheduleView; return dialogHost; }
public AttachmentForm(Issue issue, DialogType type, string path) { InitializeComponent(); this.type = type; this.issue = issue; textBoxAttachmentFilePath.Text = path; LangTools.UpdateControlsForLanguage(this.Controls); this.Text = String.Format(Lang.DlgAttachmentTitle, issue.Id, issue.Subject); }
/// <summary> /// 根据类型获取对话框信息 /// </summary> /// <param name="type"></param> /// <returns></returns> public DialogInfo GetDianDialogInfo(DialogType type) { if (!this.DialogExist(type)) { return this.AddDialog(type); } return this.dialogs[type] as DialogInfo; }
public void CreatePanle(DialogType type) { #if UNITY_EDITOR string typename = Util.ConvertPanelName(type); this.CreatePanle(typename); #else base.StartCoroutine(this.OnCreatePanel(type)); #endif }
private XNAMessageDialog(String message, DialogType type) { this.message = message; this.type = type; this.buttonWidth = 100; this.buttonSpacing = 30; this.DoLayout(); }
public iFolderMsgDialog( Gtk.Window parent, DialogType type, ButtonSet buttonSet, string title, string statement, string secondaryStatement) : base() { Init(parent, type, buttonSet, title, statement, secondaryStatement, null); }
public void ShowDialog (DialogType type, ICommand yesAction) { switch (type) { case DialogType.AddTeamDialog: AddTeamDialog (yesAction).Show (); break; default: throw new ArgumentException (); } }
public CreateEditResearchWindow(DialogType dt, ResearchType rt, Guid id) { Debug.Assert(SessionManager.ResearchExists(id)); Debug.Assert(SessionManager.GetResearchType(id) == rt); dType = dt; rType = rt; researchId = id; InitializeComponent(); InitializeTexts(); }
public void ShowDialog(DialogType type, CharacterPos cPos, CharacterType chType, string text, bool isDisplayContinue, Rect rectPanel, int hatIndex, bool hideTipball = false) { if (_dialog == null) { var go = Instantiate(ResourceLoadUtils.Load <GameObject>("Framework/Core/Tutorial/Dialog/Dialog")) as GameObject; _dialog = go.transform as RectTransform; _dialog.SetParent(SwitchTransform, false); _dialog.localScale = Vector3.one; } _dialog.gameObject.SetActive(false); RectTransform root = _dialog.Find(type.ToString()) as RectTransform; Text contentText = null; for (int i = 0; i < _dialog.childCount; ++i) { var go = _dialog.GetChild(i).gameObject; go.SetActive(type.ToString() == go.name); if (type.ToString() == go.name) { contentText = go.transform.Find("Background/Text").GetComponent <Text>(); } } if (contentText) { contentText.text = text; } Transform rtrans = null; switch (type) { case DialogType.Anywhere: root.anchorMin = new Vector2(rectPanel.xMin, rectPanel.yMin); root.anchorMax = new Vector2(rectPanel.xMax, rectPanel.yMax); for (CharacterPos i = 0; i < CharacterPos.Count; ++i) { var parentTrans = root.Find("Background/" + i.ToString() + "/Tipball"); parentTrans.parent.gameObject.SetActive(i == cPos); if (i == cPos) { rtrans = parentTrans; var anchorPos = (rtrans.parent as RectTransform).anchoredPosition; Rect rootRect = UIUtils.GetRectInCanvas(GetCanvas(), root.Find("Background") as RectTransform); switch (cPos) { case CharacterPos.BottomLeft: (rtrans.parent as RectTransform).anchoredPosition = new Vector2(rootRect.width * -.3f, anchorPos.y); break; case CharacterPos.BottomRight: (rtrans.parent as RectTransform).anchoredPosition = new Vector2(rootRect.width * .3f, anchorPos.y); break; } } } root.Find("Background/ClickContinuePic").gameObject.SetActive(isDisplayContinue); break; case DialogType.Bottom: rtrans = root.Find("Background/Tipball"); root.Find("Background/ClickContinuePic").gameObject.SetActive(isDisplayContinue); break; } for (int i = 0; i < _tipBalls.Length; ++i) { if ((int)chType == i && !hideTipball) { if (_tipBalls[i] == null) { _tipBalls[i] = Instantiate(ResourceLoadUtils.Load <GameObject>("Framework/Core/Tutorial/Dialog/" + chType.ToString()), rtrans, false); } else { _tipBalls[i].transform.SetParent(rtrans, false); _tipBalls[i].SetActive(true); } for (int j = 0; j < _tipBalls[i].transform.childCount; j++) { _tipBalls[i].transform.GetChild(j).gameObject.SetActive(hatIndex == j); } } else { if (_tipBalls[i]) { _tipBalls[i].SetActive(false); } } } _dialog.gameObject.SetActive(true); EnableParentCanvasRaycaster(_dialog); }
public DialogViewModel(string title, IScreen viewModel, TChoice[] choices, DialogType dialogType = DialogType.None, Action <ButtonContext <TChoice> > buttonHandler = null) : this(title, viewModel, DialogManager.ConvertToButtons(choices), dialogType, buttonHandler) { }
public DialogResult(DialogType type, ContentDialogResult resultType) { Type = type; ResultType = resultType; }
internal Func <string> RequestDialog(IMyFaction npcFaction, DialogType type) { AiSessionCore.DebugLog?.WriteToLog("RequestDialog", $"npcFaction:\t{npcFaction?.Tag}\tDialogType:\t{type}"); Func <string> message = DefaultDialogs.CatchAll; Func <string> tmpMessage; switch (type) { case DialogType.CollectiveDisappointment: message = DefaultDialogs.CollectiveDisappointment; break; case DialogType.CollectiveReprieve: message = DefaultDialogs.CollectiveReprieve; break; case DialogType.CollectiveWelcome: message = DefaultDialogs.CollectiveWelcome; break; case DialogType.FirstPeaceAccepted: if (npcFaction != null && _factionFirstPeaceAcceptedDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.PeaceAccepted: if (npcFaction != null && _factionPeaceAcceptedDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.PeaceConsidered: if (npcFaction != null && _factionPeaceConsideredDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.PeaceProposed: if (npcFaction != null && _factionPeaceProposedDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.PeaceRejected: if (npcFaction != null && _factionPeaceRejectedDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.WarDeclared: if (npcFaction != null && _factionWarDeclaredDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; case DialogType.WarReceived: if (npcFaction != null && _factionWarReceivedDialog.TryGetValue(npcFaction.Tag, out tmpMessage)) { message = tmpMessage; } break; // ReSharper disable once RedundantEmptySwitchSection default: break; } return(message); }
private static void CommonPanel(string title, string startingDirectory, string defaultName, string[] extensionArray, DialogType dialogType, bool allowMultipleSelection, Action <bool, string> onDone) { if (title == null) { title = string.Empty; } if (startingDirectory == null) { startingDirectory = string.Empty; } startingDirectory = startingDirectory.Replace(@"\\", "/").Replace(@"\", "/"); if (defaultName == null) { defaultName = string.Empty; } string extensionString = ""; if (extensionArray != null && extensionArray.Length != 0) { extensionString = "Files ("; for (int i = 0; i < extensionArray.Length; i++) { if (extensionArray[i].Contains(",") || extensionArray[i].Contains(".") || extensionArray[i].Contains("*")) { Debug.LogError("[FileBrowserWindows] Extensions should not contain , . or *"); return; } extensionString += "*." + extensionArray[i] + ", "; } if (extensionString.EndsWith(", ")) { extensionString = extensionString.Substring(0, extensionString.Length - 2); } extensionString += ")|"; for (int i = 0; i < extensionArray.Length; i++) { extensionString += "*." + extensionArray[i] + ";"; } } Debug.Log(Application.streamingAssetsPath); string fileBrowserExePath = Application.streamingAssetsPath + "/FileBrowser.exe"; ThreadStart threadStart = new ThreadStart(() => { Process process = new Process(); process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Arguments = "/c \"" + "\"" + fileBrowserExePath + "\"" + " \"" + Process.GetCurrentProcess().Id + "\"" + " \"" + title + "\"" + " \"" + startingDirectory + "\"" + " \"" + defaultName + "\"" + " \"" + extensionString + "\"" + " \"" + allowMultipleSelection.ToString() + "\"" + " \"" + (int)dialogType + "\"" + "\""; process.Start(); process.WaitForExit(); //string error = process.StandardError.ReadToEnd(); //if (!string.IsNullOrEmpty(error)) //{ // error = GetStringFromUnicode(error.Trim()); // Debug.LogError("[FileBrowserWindows] Error:" + error); // onDone(true, error.Trim()); //} string result = process.StandardOutput.ReadToEnd(); if (!string.IsNullOrEmpty(result)) //&& string.IsNullOrEmpty(error)) { result = GetStringFromUnicode(result.Trim()); if (!result.Equals("cancel")) { result = System.IO.File.ReadAllText(result); // We read the content of the tmp file, containing the result } onDone(false, result); } process.Close(); }); Thread thread = new Thread(threadStart); thread.Start(); }
internal ShowDialog(int id, string label, uint eventMask, DialogType dialogType) : base(id, label, eventMask, false) { m_DialogType = dialogType; }
/// <summary> /// Buttons are generated by conventions, based on the order of the passed in <see cref="ButtonChoice"/>s. /// The left most button is used to confirm and the right most button to cancel. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="dialogType"></param> /// <param name="choices"></param> /// <returns></returns> public virtual Task <bool?> ShowMessageBox(string title, string message, DialogType dialogType, params ButtonChoice[] choices) { var buttons = ConvertToButtons(choices); return(ShowMessageBox(title, message, dialogType, buttons)); }
public DialogAssertionServerEvent(DialogType dialogType) { DialogType = dialogType; }
public FatalSilverlightExceptionServerEvent(DialogType dialogType) { DialogType = dialogType; }
public Dialog Type(DialogType value) { type = "panel-" + value.ToString().ToLower(); return(this); }
public void Regist(DialogType type, DialogController controller) { _dialogMap[type] = controller; }
public bool DialogExist(DialogType type) { return(this.dialogs.ContainsKey(type)); }
public DialogViewModel(string title, IScreen viewModel, IEnumerable <ButtonContext <TChoice> > buttons, DialogType dialogType = DialogType.None, Action <ButtonContext <TChoice> > buttonHandler = null) { if (viewModel == null || buttons == null) { throw new ArgumentNullException(); } DisplayName = title; DialogType = dialogType; ViewModel = viewModel; Buttons = new BindableCollection <ButtonContext <TChoice> >(buttons); _buttonHandler = buttonHandler; this.WhenInitialized(disposables => { ButtonClickCommand = ReactiveCommand.Create <ButtonContext <TChoice>, Unit>(OnButtonClicked).DisposeWith(disposables); }); }
public BsDialog Type(DialogType type) { Attributes["type"] = string.Format("BootstrapDialog.TYPE_{0}", type.ToString().ToUpper()); SetScript(); return(this); }
public OpenSearchDialogMessage(DialogType type) { Type = type; }
public CODE(DIALOG_CODE value, Activity message, DialogType dialog) { this.code = value; this.activity = message; this.dialog = dialog; }
/// <summary> /// Показать диалоговое окно в заданном гриде с блокировкой его элементов управления. /// </summary> /// <param name="SourceGrid">Грид в котором будет отображено диалоговое окно.</param> /// <param name="DialogTitle">Заголовок окна.</param> /// <param name="DialogText">Текст в окне.</param> /// <param name="Dialogtype">Тип окна (по умолчанию ОК).</param> /// <param name="DialogImage">Изображение в окне (по умолчанию пусто).</param> /// <returns></returns> public async Task <DialogResult> ShowDialog(Grid SourceGrid, string DialogTitle, string DialogText, DialogType Dialogtype = DialogType.Ok, BitmapImage DialogImage = null) { // Фрейм для блокирования элементов управления грида и отображения диалога. var DialogFrame = new Frame { Background = new SolidColorBrush(Color.FromArgb(0x80, 0xff, 0xff, 0xff)), NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden }; IDialog dialog = new Dialog(DialogTitle, DialogText, Dialogtype, DialogImage); DialogFrame.Content = dialog; // Расположение фрейма с диалогом поверх элементов управления грида. SourceGrid.Children.Add(DialogFrame); // Запуск анимации появления диалога с указанием его конечной ширины и высоты. dialog.OpenAnimate(400, 140); var tcs = new TaskCompletionSource <DialogResult>(); void action(DialogResult d) => tcs.TrySetResult(d); try { // Ожидание нажатия на кнопку диалога. dialog.ButtonClick += action; await tcs.Task; return(tcs.Task.Result); } finally { // Закрытие диалога. dialog.ButtonClick -= action; dialog.CloseAnimate(); dialog.Closed += Dialog_Closed; } // Завершение анимации закрытия диалога. void Dialog_Closed() { // Удаление фрейма из грида. SourceGrid.Children.Remove(DialogFrame); } }
public static void ShowDlg(DialogType type) { new Dialogs(type).ShowDialog(); }
/// <summary> /// Use a Open or Save dialog to select a file. /// </summary> /// <param name="windowTitle"> /// The window title. /// </param> /// <param name="ext"> /// The default file extention /// </param> /// <param name="filter"> /// The filter /// </param> /// <param name="type"> /// The dialog type. /// </param> /// <returns> /// The select file. /// </returns> public static string SelectFile(string windowTitle, string ext, string filter, DialogType type) { if (type == DialogType.Load) { var ofd = new OpenFileDialog { Multiselect = false, Title = windowTitle, DefaultExt = ext, Filter = filter }; if (ofd.ShowDialog() == DialogResult.Cancel) { return(String.Empty); } return(ofd.FileName); } else { var ofd = new SaveFileDialog { Title = windowTitle, DefaultExt = ext, Filter = filter }; if (ofd.ShowDialog() == DialogResult.Cancel) { return(String.Empty); } return(ofd.FileName); } }
public CustomFileDialog(DialogType type, string fileName, FileDialogFilterArgs filter = null) { _type = type; _fileName = fileName; _filter = filter ?? FileDialogFilterArgs.DefaultFilter; }
public IDialogBuilder <T> WithDialogType(DialogType dialogType) { _dialogType = dialogType; return(this); }
public DialogMessage(string message, string header, DialogType type) { DialogType = type; Message = message; Header = header; }
public MvvmDialogEventArgs(DialogType type, Action actionAfterCreate = null) { this.type = type; this.actionAfterCreate = actionAfterCreate; }
// TODO: use a custom MessageBox that supports detail message public void ShowDetailedDialog(string titleMessage, string contentMessage, string detailMessage, DialogType dialogType) { MessageBox.Show(App.Current.MainWindow, contentMessage + "\n\n" + detailMessage, titleMessage, MessageBoxButton.OK); }
public static void StartDialog(Character character, ushort npcId, DialogType optionId, uint subOptionId) { if (character.OpenedShopType != ShopType.None) { return; } var npc = WorldManager.Instance.GetNpc(npcId); if (npc == null) { return; } if (!MathUtils.CheckInRange(character.Position, npc.Position, 5)) { return; } if (optionId <= 0) { if (npc.DialogList == null || npc.DialogList.Count <= 0) { return; } character.SendPacket(new OpenNpcChat(npc.Id)); character.SendPacket(new PlaySound(npc.SoundId, npc.SoundType)); character.SendPacket(new ResetChatOptions()); var quests = npc.AvailableQuests(character); if (quests.Count > 0) { var temp = new NpcDialog(DialogType.Quest, 0, $"Mission ({quests.Count})"); character.SendPacket(new SendNpcOption(temp)); } foreach (var dialog in npc.DialogList) { if (dialog.SubOptionId == 0) { var temp = new NpcDialog(dialog.OptionId, 0, dialog.Text); character.SendPacket(new SendNpcOption(temp)); } } Log.Debug("OpenedChat, NpcId: {0}, Id: {1}", npc.NpcId, npc.Id); } else if (optionId == DialogType.Talk || optionId == DialogType.Quest || optionId == DialogType.Teleport) { character.SendPacket(new ResetChatOptions()); switch (optionId) { case DialogType.Quest when subOptionId <= 0: { var quests = npc.AvailableQuests(character); foreach (var quest in quests) { var temp = new NpcDialog(DialogType.Quest, quest.Id, $"({quest.Id}) {quest.Name}"); character.SendPacket(new SendNpcOption(temp)); } character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.ChatClose, 0, "Close"))); } break; case DialogType.Quest when subOptionId > 0: { var quest = npc.GetQuest((ushort)subOptionId); if (quest == null) { character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.ChatClose, 0, "Close"))); return; } character.SendPacket(new PlaySound(7, SoundType.Bgm)); switch (npc.IsQuestAvailable(quest, character)) { case QuestState.Available: character.SendPacket(new NpcStartTalk(quest.StartDialog)); character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.QuestAccept, subOptionId, "Accept"))); break; case QuestState.OnProgress: character.SendPacket(new NpcStartTalk(quest.UnfinishedDialog)); break; case QuestState.Completed: character.SendPacket(new NpcStartTalk(quest.EndDialog)); character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.QuestReward, subOptionId, "Reward"))); break; } character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.Quest, 0, "Menu"))); character.SendPacket(new SendNpcOption(new NpcDialog(DialogType.ChatClose, 0, "Close"))); } break; case DialogType.Talk: break; case DialogType.Teleport: break; } } else { character.SendPacket(new ResetChatOptions()); character.SendPacket(new CloseNpcChat()); // TODO - CHECK IF CAN OPEN switch (optionId) { case DialogType.Store: { if (npc.StoreItems != null && npc.StoreType == StoreType.Normal) { character.SendPacket(new NpcStoreOpen(npc.Id, npc.StoreType, npc.StoreItems)); character.OpenedShopType = ShopType.Store; character.OpenedShopNpcConId = npc.Id; } Log.Debug("Store: NpcId: {0}, StoreType: {1}", npc.NpcId, npc.StoreType); } break; case DialogType.StoreSkill: { // TODO - THIS STORE CHANGES DYNAMICALLY // This is just placeholder if (npc.StoreItems != null && npc.StoreType != StoreType.Normal) { character.SendPacket(new NpcStoreOpen(npc.Id, npc.StoreType, npc.StoreItems)); character.OpenedShopType = ShopType.SkillShop; character.OpenedShopNpcConId = npc.Id; } Log.Debug("Store: NpcId: {0}, StoreType: {1}", npc.NpcId, npc.StoreType); } break; case DialogType.Bank: character.Inventory.SendBankData(); OpenShop(character, ShopType.Bank, npc.Id); break; case DialogType.PranStation: character.Inventory.SendBankData(); OpenShop(character, ShopType.PranStation, npc.Id); break; case DialogType.GuildCreate: character.SendPacket(new CreateGuildBox(character.Connection.Id, 0)); break; case DialogType.GuildBank: break; case DialogType.DialogEnd: break; case DialogType.Fortification: OpenShop(character, ShopType.Fortification, npc.Id); break; case DialogType.Enchant: OpenShop(character, ShopType.Enchant, npc.Id); break; case DialogType.ChangeNation: break; case DialogType.QuestMenu: break; case DialogType.QuestAccept: { var questData = npc.GetQuest((ushort)subOptionId); if (npc.IsQuestAvailable(questData, character) != QuestState.Available) { return; } var quest = character.Quests.AddQuest(questData); if (quest != null) { character.SendPacket(new SendMessage(new Message($"You have accepted the mission '{questData.Name}'"))); character.SendPacket(new SendQuestInfo(quest)); character.SendPacket(new SetEffectOnHead(npc.Id, EffectType.QuestOngoing)); character.SendPacket(new PlaySound(446, SoundType.NpcVoice)); } } break; case DialogType.QuestReward: { var questData = npc.GetQuest((ushort)subOptionId); if (npc.IsQuestAvailable(questData, character) != QuestState.Completed) { return; } character.Quests.AddReward(questData.Id); } break; case DialogType.SaveLocation: break; case DialogType.EnterInstance: break; case DialogType.Repair: OpenShop(character, ShopType.Repair, npc.Id); break; case DialogType.RepairAll: OpenShop(character, ShopType.RepairAll, npc.Id); break; case DialogType.BlessFree: break; case DialogType.Upgrade: break; case DialogType.QuestReward2: break; case DialogType.NationStatus: break; case DialogType.GuildSkills: break; case DialogType.PranCostumeEnchant: OpenShop(character, ShopType.PranCostumeEnchant, npc.Id); break; case DialogType.BlessPaid: break; case DialogType.Evolution: OpenShop(character, ShopType.Evolution, npc.Id); break; case DialogType.BattleField: break; case DialogType.TeleportDisckeroa: { character.TeleportTo(1893.4f, 3787.4f); Log.Debug("TeleportTo: Disckeroa"); } break; case DialogType.MoveToWar: break; case DialogType.RegisterWar: break; case DialogType.StoneRefinement: OpenShop(character, ShopType.StoneRefinement, npc.Id); break; case DialogType.StoneEnchant: OpenShop(character, ShopType.StoneEnchant, npc.Id); break; case DialogType.StoneCombination: OpenShop(character, ShopType.StoneCombination, npc.Id); break; case DialogType.Craft: OpenShop(character, ShopType.Craft, npc.Id); break; case DialogType.Dismantle: OpenShop(character, ShopType.Dismantle, npc.Id); break; case DialogType.Transfer: OpenShop(character, ShopType.Transfer, npc.Id); break; case DialogType.LevelDown: OpenShop(character, ShopType.LevelDown, npc.Id); break; case DialogType.ChatClose: break; default: return; } } }
//获得界面 public GameObject GetDialog(DialogType dialogType) { return(dialogMap[dialogType]); }
public DialogManager(DialogType type, DialogAction action) { Type = type; Action = action; }
public void ShowProgressDialog(Context context, Stream stream, MaskType maskType, float progress, bool isIndeterminate = true, DialogType dialogType = DialogType.BottomStatus, string status = null, string dismissDescription = null, TimeSpan?timeout = null, Action clickCallback = null, Action dismissCallback = null) { if (!timeout.HasValue) { timeout = TimeSpan.Zero; } if (CurrentDialog != null && _animationView == null) { DismissCurrent(context); } lock (_dialogLock) { if (CurrentDialog == null) { Application.SynchronizationContext.Send(state => { CurrentDialog = new Dialog(context); CurrentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle); if (maskType != MaskType.Black) { CurrentDialog.Window.ClearFlags(WindowManagerFlags.DimBehind); } if (maskType == MaskType.None) { CurrentDialog.Window.SetFlags(WindowManagerFlags.NotTouchModal, WindowManagerFlags.NotTouchModal); } CurrentDialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent)); var inflater = LayoutInflater.FromContext(context); View view; switch (dialogType) { case DialogType.BottomStatus: view = inflater.Inflate(Resource.Layout.bottom_header_progress_dialog, null); _statusView = view.FindViewById <TextView>(Resource.Id.bottom_textViewStatus); break; case DialogType.TextOnly: view = inflater.Inflate(Resource.Layout.center_header_progress_dialog, null); _statusView = view.FindViewById <TextView>(Resource.Id.center_textViewStatus); break; case DialogType.TopStatus: view = inflater.Inflate(Resource.Layout.top_header_progress_dialog, null); _statusView = view.FindViewById <TextView>(Resource.Id.top_textViewStatus); break; case DialogType.AnimationOnly: view = inflater.Inflate(Resource.Layout.animation_only_progress_dialog, null); break; default: throw new ArgumentOutOfRangeException(nameof(dialogType), dialogType, null); } if (clickCallback != null) { view.Click += (sender, e) => clickCallback(); } _animationView = view.FindViewById <LottieAnimationView>(Resource.Id.lottieAnimationView); try { LottieComposition.FromInputStream(context, stream, lottieComposition => { _animationView.SetComposition(lottieComposition); _animationView.Loop(isIndeterminate); if (!isIndeterminate) { _animationView.PauseAnimation(); } }); } catch (Exception e) { Console.WriteLine(e); } switch (maskType) { case MaskType.None: view.SetBackgroundResource(Resource.Drawable.roundedbgdark); _statusView?.SetTextColor(Color.White); break; case MaskType.Clear: view.SetBackgroundColor(Color.Transparent); _statusView?.SetTextColor(Color.Black); break; case MaskType.Black: view.SetBackgroundResource(Resource.Drawable.roundedbg_white); _statusView?.SetTextColor(Color.Black); break; case MaskType.Gradient: view.SetBackgroundResource(Resource.Drawable.roundedbg_white); _statusView?.SetTextColor(Color.Black); break; default: throw new ArgumentOutOfRangeException(nameof(maskType), maskType, null); } if (_statusView != null) { _statusView.Text = status ?? ""; _statusView.Visibility = string.IsNullOrEmpty(status) ? ViewStates.Gone : ViewStates.Visible; } CurrentDialog.SetContentView(view); CurrentDialog.SetCancelable(dismissCallback != null); if (dismissCallback != null) { CurrentDialog.CancelEvent += (sender, e) => dismissCallback(); } CurrentDialog.Show(); }, null); if (timeout.Value > TimeSpan.Zero) { Task.Factory.StartNew(() => { if (!_waitDismiss.WaitOne(timeout.Value)) { DismissCurrent(context); } }).ContinueWith(ct => { var ex = ct.Exception; if (ex != null) { Log.Error("LottieDialog", ex.ToString()); } }, TaskContinuationOptions.OnlyOnFaulted); } } else { Application.SynchronizationContext.Send(state => { _animationView.Progress = progress / 100; if (_statusView != null) { _statusView.Text = status ?? ""; } }, null); } } }
/// <summary> /// Interact with user by dialog. /// </summary> /// <param name="state"></param> private void WaitUserInteraction(object state) { // The schema for the data object is 1:dialogType,2:dialog ID,3:topic and 4:text. object[] objects = (object[])state; DialogType dialogType = (DialogType)objects[0]; int dialogID = (int)objects[1]; string topic = (string)objects[2]; string text = (string)objects[3]; System.Windows.Forms.DialogResult dialogResult; object[] outputObjects = null; switch (dialogType) { case DialogType.InitialPukeConfirm: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.OK); outputObjects = new object[1]; outputObjects[0] = dialogType; break; case DialogType.InitialFadeLevelReached: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.YesNo); outputObjects = new object[3]; outputObjects[0] = dialogType; if (dialogResult == System.Windows.Forms.DialogResult.Yes) { outputObjects[1] = true; } else { outputObjects[1] = false; } if (text.Contains("long")) { outputObjects[2] = TradeSide.Buy; } else if (text.Contains("short")) { outputObjects[2] = TradeSide.Sell; } else { outputObjects[2] = TradeSide.Unknown; } break; case DialogType.InitialEntryLevelReached: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.YesNo); outputObjects = new object[3]; outputObjects[0] = dialogType; if (dialogResult == System.Windows.Forms.DialogResult.Yes) { outputObjects[1] = true; } else { outputObjects[1] = false; } if (text.Contains("long")) { outputObjects[2] = TradeSide.Buy; } else if (text.Contains("short")) { outputObjects[2] = TradeSide.Sell; } else { outputObjects[2] = TradeSide.Unknown; } break; case DialogType.PositionValidationYesNo: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.YesNo); outputObjects = new object[2]; outputObjects[0] = dialogType; if (dialogResult == System.Windows.Forms.DialogResult.Yes) { outputObjects[1] = true; } else { outputObjects[1] = false; } break; case DialogType.PositionValidationInput: int correctPosition = 0; string inputPosition = null; while (string.IsNullOrEmpty(inputPosition)) { inputPosition = Microsoft.VisualBasic.Interaction.InputBox(text, topic, "0"); } outputObjects = new object[2]; outputObjects[0] = dialogType; if (Int32.TryParse(inputPosition, out correctPosition)) { outputObjects[1] = correctPosition; } else { outputObjects[1] = 0; } break; case DialogType.VariablesChangedNotice: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.OK); outputObjects = new object[1]; outputObjects[0] = dialogType; break; case DialogType.StopOrderTriggered: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.OK); outputObjects = new object[1]; outputObjects[0] = dialogType; break; case DialogType.OverFillsStopLoss: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.OK); outputObjects = new object[1]; outputObjects[0] = dialogType; break; case DialogType.ExchangeOpenCloseNotice: dialogResult = System.Windows.Forms.MessageBox.Show(text, topic, System.Windows.Forms.MessageBoxButtons.OK); outputObjects = new object[1]; outputObjects[0] = dialogType; break; } if (m_PopUpDictionary.ContainsKey(dialogID)) { m_PopUpDictionary.Remove(dialogID); } PopUpEventArgs eventArgs = new PopUpEventArgs(); eventArgs.Data = outputObjects; if (DialogUserComplete != null) { DialogUserComplete(this, eventArgs); } }
public async Task <ImprovedInstantMessageMessage> SendInstantMessage(bool isFromGroup, Guid toAgentId, UInt32 parentEstateId, DialogType dialogType, Guid id, string message, byte[] binaryBucket) { Guid agentId = Session.Instance.AgentId; Guid sessionId = Session.Instance.SessionId; Guid regionId = Guid.Empty; // TODO: Should I ever specify this? Vector3 position = Vector3.zero; // TODO: Should I ever specify this? OnlineMode onlineMode = OnlineMode.Online; UInt32 timestamp = 0; // TODO: Tests show this as 0 string fromAgentName = Agent.CurrentPlayer.DisplayName; ImprovedInstantMessageMessage msg = new ImprovedInstantMessageMessage(agentId, sessionId, isFromGroup, toAgentId, parentEstateId, regionId, position, onlineMode, dialogType, id, timestamp, fromAgentName, message, binaryBucket); await SendReliable(msg); return(msg); }