//===================================================================== #region Publics Static methods. /// <summary> /// Create a concrete and full AppController, set it into the Provider. /// This object Builder permit ot have an AppController with interfaces. /// </summary> /// <returns></returns> public static IAppCtrl CreateAppCtrl() { // the application messenger, has log to help debug AppMessenger messenger = new AppMessenger(); messenger.ActivityLog += Messenger_ActivityLog; // create the common dialogBox manager, need the main window as a parent CommonDlg commonDlg = new CommonDlg(); commonDlg.SetCurrentCultureInfo(CultureCode.en_GB); // dlgbox needs the window parent AppDlg appDlg = new AppDlg(); AppCtrl appCtrl = new AppCtrl(messenger, commonDlg, appDlg); // save it into the AppCtrl provider (used by VM) AppCtrlProvider.Instance.SetAppCtrl(appCtrl); // create the main window, AFTER the controller MainWindow mainWindow = new MainWindow(); commonDlg.SetMainWindow(mainWindow); appCtrl.SetMainWindow(mainWindow); appDlg.SetMainWindow(mainWindow); return(appCtrl); }
/// <summary> /// Define all the dialog translated text. /// </summary> private void SetAllUserDefinedTranslatedText() { CommonDlg.SetUserDefinedTranslatedText(StringCode.Cancel, "User-Cancel"); CommonDlg.SetUserDefinedTranslatedText(StringCode.Close, "User-Close"); CommonDlg.SetUserDefinedTranslatedText(StringCode.DlgErrorTitle, "User-Error"); CommonDlg.SetUserDefinedTranslatedText(StringCode.DlgInformationTitle, "User-Information"); CommonDlg.SetUserDefinedTranslatedText(StringCode.DlgQuestionTitle, "User-Question"); CommonDlg.SetUserDefinedTranslatedText(StringCode.DlgWarningTitle, "User-Warning"); CommonDlg.SetUserDefinedTranslatedText(StringCode.No, "User-No"); CommonDlg.SetUserDefinedTranslatedText(StringCode.Ok, "User-Ok"); CommonDlg.SetUserDefinedTranslatedText(StringCode.Yes, "User-Yes"); }
private void DoLoadXml() { try { string filename = CommonDlg.FileDialog("(*.xml)|*.xml", Environment.CurrentDirectory); if (string.IsNullOrEmpty(filename)) { return; } string name = GetSelectedItem(); AsyncLoaderForm f = new AsyncLoaderForm(this, filename, name); f.InvokeLoader(null); this.DoRefresh(); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
private void DoSaveXml() { try { string filename = CommonDlg.SaveAs("(*.xml)|*.xml", Environment.CurrentDirectory); if (string.IsNullOrEmpty(filename)) { return; } string name = GetSelectedItem(); //RemoteQueue Client = new RemoteQueue(name); //DataTable dt= Client.GetQueueItemsTable(); //DataSet ds = new DataSet("RemoteQueue"); //ds.Tables.Add(dt.Copy()); //ds.WriteXml(filename); } catch (Exception ex) { MsgBox.ShowError(ex.Message); } }
protected void setToSkipWrongDlg(CommonDlg dlg) { SkillTreeCell cell = selectedCell.GetComponent<SkillTreeCell>(); dlg.setOneBtnDlg("CANCEL"); dlg.ShowCommonStr(string.Format(Localization.instance.Get("UI_CommonDlg_SkipSkillTraining_NotEnoughCP"), cell.skillDef.name, Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds))); dlg.playErrorMusic(); dlg.OnUpdateStr = () => { if (SkillLearnedData.LearnedState.LEARNING != cell.learnedData.State){ dlg.OnUpdateStr = null; // descDlg.SetSkippingBtnVisible(false); Destroy(dlg.gameObject); } else{ if (UserInfo.instance.getCommandPoints() >= Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds)){ setToSkipConfirmDlg(dlg); } } }; }
protected void setToSkipConfirmDlg(CommonDlg dlg) { SkillTreeCell cell = selectedCell.GetComponent<SkillTreeCell>(); dlg.setNormalDlg(); dlg.OnUpdateStr = () => { if (SkillLearnedData.LearnedState.LEARNING != cell.learnedData.State){ dlg.OnUpdateStr = null; // descDlg.SetSkippingBtnVisible(false); Destroy(dlg.gameObject); } else dlg.ShowCommonStr(string.Format(Localization.instance.Get("UI_CommonDlg_TrainSkillWithCP"), cell.skillDef.name, Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds))); }; dlg.onYes = () => { UserInfo.instance.consumeCommandPoints(Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds)); cell.learnedData.SkipLearningTime(); descDlg.SetSkippingBtnVisible(false); dlg.OnUpdateStr = null; StartCoroutine(delayPlayRechargedMusic()); }; dlg.onNo = () => { MusicManager.playEffectMusic("SFX_UI_button_tap_2a"); }; }