private void Start() { onGameLoad?.Invoke(cachedSaveData); if (isNewGame) { onNewGameStarted.Invoke(); onGameSave?.Invoke(cachedSaveData); } }
private void Start() { cachedSaveData = SaveUtility.LoadSave(saveSlot.Value); if (cachedSaveData == null) { Debug.Log("cachedSaveData == null"); CreateNewSave(); } onGameLoad?.Invoke(cachedSaveData); }
public void Delete() { if (SelectedStep == null) { return; } var diagle = windowManager.ShowMessageBox(String.Format("确定要删除"), "系统提示", MessageBoxButton.YesNo); if (diagle == MessageBoxResult.Yes) { List <T_LogicStep> selsteps = new List <T_LogicStep>(SelectedStep.ToArray()); foreach (var selstep in selsteps) { if (this.logicService.DeleteT_LogicStep(selstep.ID)) { var CurrentIndex = StepList.IndexOf(selstep); for (int i = CurrentIndex; i < StepList.Count; i++) { StepList[i].OrderIndex = StepList[i].OrderIndex - 1; } StepList.Remove(selstep); Program.LogicSteps = StepList.ToList(); SaveEvent?.Invoke(Program); } else { this.View.ShowHint(new MessageWin(false)); } } } }
public static bool Save() { if (textBlock == null) { textBlock = new TextBlock(); } foreach (Parameter parameter in parameters) { parameter.Save(textBlock); } SaveEvent?.Invoke(/*this, textBlock */); try { string directoryName = Path.GetDirectoryName(realFileName); if (directoryName != "" && !Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } using (StreamWriter writer = new StreamWriter(realFileName)) { writer.Write(textBlock.DumpToString()); } } catch { Log.Error("Unable to save file \"{0}\".", realFileName); return(false); } return(true); }
/// <summary> /// Save Objects /// </summary> /// <param name="objDatas">Objects</param> public sealed override async Task SaveAsync(params DT[] objDatas) { #region Verify Parameters if (objDatas == null || objDatas.Length <= 0) { throw new Exception("objDatas is null or empty"); } foreach (var obj in objDatas) { if (obj == null) { throw new Exception("save object data is null"); } if (!obj.CanBeSave) { throw new Exception("object data cann't to be save"); } } #endregion await ExecuteSaveAsync(objDatas).ConfigureAwait(false); //Execute Save SaveEvent?.Invoke(objDatas); //Execute Save Event #region After Save Operations foreach (var data in objDatas) { data.MarkStored();//Mark Object Has Stored } #endregion }
public event QueryData <DT> QueryEvent; //查询事件 #endregion #region 接口方法 /// <summary> /// 保存对象集合 /// </summary> /// <param name="objList">对象信息</param> public sealed override void Save(params DT[] objDatas) { #region 参数验证 if (objDatas == null || objDatas.Length <= 0) { throw new AppException("objDatas is null or empty"); } foreach (var obj in objDatas) { if (obj == null) { throw new AppException("save object data is null"); } if (!obj.CanBeSave) { throw new AppException("object data cann't to be save"); } } #endregion ExecuteSave(objDatas); //执行保存 SaveEvent?.Invoke(objDatas); //保存事件 #region 保存后数据操作 foreach (var data in objDatas) { data.MarkStored();//标记为已保存 } #endregion }
private void Save_Click(object sender, RoutedEventArgs e) { string richText = new TextRange(content.Document.ContentStart, content.Document.ContentEnd).Text; SaveEvent?.Invoke(this, new SaveEventArgs { FileName = fileName.Text, Content = richText }); }
private void btn_save_Click(object sender, EventArgs e) { if (SaveEvent != null) { SaveEvent.Invoke(this, GetArgs()); } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
protected virtual bool OnSave(string saveAsFileName) { //event { bool handled = false; bool result = false; SaveEvent?.Invoke(this, saveAsFileName, ref handled, ref result); if (handled) { return(result); } } //!!!!? if (LoadedResource != null && LoadedResource.ResultComponent != null && LoadedResource.Owner.LoadFromFile) { string realPathWithoutAddFileExtension; string realPath; if (!string.IsNullOrEmpty(saveAsFileName)) { realPathWithoutAddFileExtension = saveAsFileName; realPath = saveAsFileName; } else { realPathWithoutAddFileExtension = VirtualPathUtility.GetRealPathByVirtual(LoadedResource.Owner.Name); realPath = realPathWithoutAddFileExtension + LoadedResource.Owner.GetSaveAddFileExtension(); //string name = LoadedResource.Owner.Name + LoadedResource.Owner.GetSaveAddFileExtension(); //realPath = VirtualPathUtility.GetRealPathByVirtual( name ); } //!!!!new var formWorkspaceController = (WorkspaceControllerForForm)EditorForm.instance.WorkspaceController; UpdateEditorDocumentConfiguration(formWorkspaceController); string error; if (!ComponentUtility.SaveComponentToFile(LoadedResource.ResultComponent, realPath, null, out error)) { //!!!! Log.Error(error); return(false); } PreviewImagesManager.AddResourceToProcess(realPathWithoutAddFileExtension); return(true); } else { //!!!!! Log.Warning("impl"); } return(false); }
private void ReposOKButtonClickHandler(object sender, RoutedEventArgs e) { isSuppressComboxSelectionChangeEvent = true; var currentOrd = (comboBox.SelectedItem as TemplateInformation).Ord; var newOrd = respositionFlyout.Number - 1; viewModel.RepositionTemplate(currentOrd, newOrd); ChangeSelectedItem(newOrd); isSuppressComboxSelectionChangeEvent = false; SaveEvent?.Invoke(sender, null); }
/// <summary> /// タスク登録依頼 /// </summary> public void Register() { var deadline = _deadLineText.text; var content = _taskInputField.text; if (FormValidate(content, deadline)) { Task newTask = CreateTask(content, deadline); RegisterEvent.Invoke(newTask); ValidateClear(); } }
public void Save() { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Spreadsheet (*.ss)|*.ss|All files (*.*)|*.*"; saveFileDialog.Title = "Save Spreadsheet"; saveFileDialog.ShowDialog(); if (saveFileDialog.FileName != "") { FileStream fs = (FileStream)saveFileDialog.OpenFile(); SaveEvent?.Invoke(fs); } }
private async void DeleteButtonClickHandler(object sender, RoutedEventArgs e) { if (viewModel.Templates.Count == 1) { await UIHelper.ShowMessageDialog("One note type needs at least one template!"); return; } bool isContinue = await MainPage.WarnFullSyncIfNeeded(); if (!isContinue) { return; } var countNote = viewModel.Models.TmplUseCount(viewModel.CurrentModel, comboBox.SelectedIndex); string message = String.Format(UIConst.WARN_TEMPLATE_DELETE, countNote); isContinue = await UIHelper.AskUserConfirmation(message); if (!isContinue) { return; } isSuppressComboxSelectionChangeEvent = true; var template = comboBox.SelectedItem as TemplateInformation; uint ord = template.Ord; viewModel.RemoveTemplate(template.Ord); if (ord > 0) { comboBox.SelectedItem = viewModel.Templates[(int)ord - 1]; } else { comboBox.SelectedItem = viewModel.Templates[0]; } ComboBoxSelectionChangedEvent?.Invoke(comboBox, e); isSuppressComboxSelectionChangeEvent = false; MainPage.UserPrefs.IsFullSyncRequire = true; SaveEvent?.Invoke(sender, null); }
private async void NewTemplateFlyoutOKButtonClickHandler(object sender, RoutedEventArgs e) { var name = addNewFlyout.NewName; bool isValid = await CheckNameValid(name); if (!isValid) { return; } var templateToClone = comboBox.SelectedItem as TemplateInformation; ViewModel.AddNewTemplate(name, templateToClone.Ord); comboBox.SelectedItem = viewModel.Templates.Last(); MainPage.UserPrefs.IsFullSyncRequire = true; SaveEvent?.Invoke(sender, null); AddTemplateEvent?.Invoke(); }
public void Confirm() { if (String.IsNullOrEmpty(Program.Name)) { this.View.ShowHint(new MessageWin("程序名称不能为空")); return; } Program.LogicSteps = StepList.ToList(); if (logicService.SaveT_LogicTest(Program)) { SaveEvent?.Invoke(Program); this.View.ShowHint(new MessageWin()); } else { this.View.ShowHint(new MessageWin("保存失败!")); } }
private void ButtonClickEvent(InputItemModel item) { var number = 0; if (int.TryParse(item.Text, out number)) { Value = Convert.ToDouble(Value + number).ToString(); } else { switch (item.Text) { case "✔": SaveEvent.Invoke(); break; case "⬅": if (Value.Length > 0) { Value = Value.Substring(0, Value.Length - 1); } break; case "×": CloseEvent.Invoke(); break; case ".": if (!Value.Contains(".")) { Value += item.Text; } break; case "C": Value = "0"; break; default: break; } } CheckCanSave(); }
private void AssetSaveButton_Click(object sender, RoutedEventArgs e) { int MInterval = 0, AInterval = 0; int.TryParse(MIntervalTextBox.Text, out MInterval); int.TryParse(AlertTextBox.Text, out AInterval); SaveEvent?.Invoke(this, new Asset { Name = NameTextBox.Text, Tag = TagTextBox.Text, Vendor = VendorTextBox.Text, AttentionInterval = MInterval, AlertInterval = AInterval, AttendedOn = OnDatePicker.SelectedDate.Value, Location = LocationTextBox.Text, AttentionDue = OnDatePicker.SelectedDate.Value.AddDays(MInterval) }); }
private async void RenameTemplateFlyoutOKButtonClickHandler(object sender, RoutedEventArgs e) { string name = renameFlyout.NewName; bool isValid = await CheckNameValid(name); if (!isValid) { renameFlyout.Show(editButton); return; } isSuppressComboxSelectionChangeEvent = true; var template = comboBox.SelectedItem as TemplateInformation; viewModel.RenameTemplate(name, template.Ord); ChangeSelectedItem(template.Ord); isSuppressComboxSelectionChangeEvent = false; SaveEvent?.Invoke(sender, null); }
private void SaveData() { HardwareManage.hardDoc.SaveDoc(); TableManage.tablesDoc.SaveDoc(); IOManage.IODoc.SaveDoc(); DataManage.m_Doc.SaveDoc(); PathDataManage.pathDoc.SaveDoc(); for (int i = 0; i < 5; i++) { if (InovanceManage.m_inovanceDoc[i] != null) { InovanceManage.m_inovanceDoc[i].SaveDocument(i); } } CognexManage.m_cognexDoc.SaveDocument(); CognexAsyncManage.m_cognexAsyDoc.SaveDocument(); SetOperationError("Saving Data"); if (SaveEvent != null) { SaveEvent.Invoke(); } }
public void Save() { onGameSave?.Invoke(cachedSaveData); WriteSaveToFile(); }
public void SaveEventOperation() { SaveEvent?.Invoke(this, EventArgs.Empty); }
private static async Task MainTask(string[] args) { try { Console.WriteLine("Welcome to GAFBot v0.0.1"); Rnd = new Random(); _checkForMaintenance = true; _maintenanceTask = new Task(CheckForMaintenance); LoadEnviromentVariables(); if (args != null && args.Length > 0) { foreach (string arg in args) { ProcessConsoleArg(arg); } } Logger.Initialize(); SaveEvent += () => Logger.Log("Starting Save process"); ExitEvent += () => { _checkForMaintenance = false; while (_maintenanceTask.Status == TaskStatus.Running) { Task.Delay(5).Wait(); } Logger.Log("Invoking Save Event"); SaveEvent?.Invoke(); if (Client != null) { IReadOnlyList <DiscordConnection> connections = Client.GetConnectionsAsync().Result; if (connections.Count > 0) { Logger.Log("Closing Discord connections"); Client.DisconnectAsync().Wait(); Client.Dispose(); } } }; _handler += new EventHandler(Handler); SetConsoleCtrlHandler(_handler, true); Modules.ModuleHandler.Initialize(); #if DEBUG Logger.Log("Running on DEBUG mode"); #else Logger.Log("Running on Release mode"); #endif //Loads the AutoInitAttribute InitializeAssembly(Assembly.GetEntryAssembly()); Logger.Log("Program: Starting AutoSaveTimer"); StartSaveTimer(); Logger.Log("Program: Connecting discord client"); await Client.ConnectAsync(); Logger.Log("Program: GAF Bot initialized"); _ewh = new EventWaitHandle(false, EventResetMode.AutoReset); //If you want to add custom code that should //be able to activate after discord is ready //Enter it after this method call _ewh.WaitOne(); _maintenanceTask.Start(); Console.WriteLine("Done"); } catch (Exception ex) { try { Logger.Log(ex.ToString(), LogLevel.ERROR); } catch (Exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.ToString()); Console.ForegroundColor = ConsoleColor.White; } } await Task.Delay(-1); }
/// <summary> /// Save menu item click. if filename exists, saves the item. If filename does not exist Save As is invoked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveToolStripMenuItem_Click(object sender, EventArgs e) { SaveEvent?.Invoke(); }
// Метод Сохранения. public void Save() { SaveEvent?.Invoke(this, new NewVentEventArgs("Аппарат сохранен")); Save(Venturis); }
/// <summary> /// Saves all changes in Player Data to PlayerPrefs. /// On level complete\fail use GameRestart() instead. /// </summary> public void SaveGame() { SaveEvent?.Invoke(); }
private void SaveAssetButton_Click(object sender, RoutedEventArgs e) { SaveEvent?.Invoke(this, new EventArgs()); }
public void RaiseSaveEvent() { SaveEvent?.Invoke(this, EventArgs.Empty); }
public void Save() => SaveEvent?.Invoke(this, EventArgs.Empty);
private void SaveButton_Click(object sender, EventArgs e) { SaveEvent?.Invoke(); }
public void OnClickedSaveButton() { SaveEvent?.Invoke(); }