public void save(string json) { OnSave?.Invoke(this, new SaveParseArgument { Data = json }); }
private void SaveData(ref List <SaveData> saveData) { if (Processing) { return; } Processing = true; saveData = new List <SaveData>(); foreach (Transform child in transform) { Destroy(child.gameObject); } foreach (ISaveable saveable in saveables) { SaveData newData = saveable.Save(); saveData.Add(newData); } Processing = false; GameUI.Instance().SaveLoadIndicator(true); onSave?.Invoke(); }
private void CheckAutoSave() { if (ckbAutoSave.Checked && btnSave.Enabled) { OnSave?.Invoke(); } }
/// <summary> /// Save the preferences object and invoke the required event handlers. /// </summary> public void Save() { OnPreSave?.Invoke(this, Preferences); Save(PrefPath, Preferences); OnSave?.Invoke(this, Preferences); OnUpdate?.Invoke(this, Preferences); }
public void ForceSave( ) { if (!saveRequested) { return; } lock ( FileLock ) { try { InternalForceSave( ); OnSave?.Invoke(this); } catch (Exception e) { disposable.Dispose( ); disposable = null; OnError?.Invoke(this, e); } } saveRequested = false; }
private void CreateTransaction_FormClosing(object sender, FormClosingEventArgs e) { if (changesMade) { OnSave?.Invoke(this, null); } }
private void InventoryItemView_FormClosed(object sender, FormClosedEventArgs e) { if (changesDone) { OnSave?.Invoke(this, null); } }
public void Save(object param) { BlowTrialDataService.SetBackupDetails( CloudModel.CloudDirectoryItems.Select(c => c.DirectoryPath), CloudModel.BackupIntervalMinutes.Value); OnSave?.Invoke(this, new EventArgs()); CloseCmd.Execute(null); }
private void addSuppBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to add a new Supplier?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } using (var p = new POSEntities()) { var name = supplierName.Text.Trim(' '); var contact = contactDetails.Text.Trim(' '); //if(p.Suppliers.Any(x=>x.Name == name )) //{ // MessageBox.Show("Supplier already present."); // return; //} var newSupplier = new Supplier(); newSupplier.Name = name; newSupplier.ContactDetails = contact; p.Suppliers.Add(newSupplier); supplierTable.Rows.Add(newSupplier.Id, newSupplier.Name, newSupplier.ContactDetails, "Delete"); //suppliers.Add(newSupplier); p.SaveChanges(); } resetAutoComplete(); OnSave?.Invoke(this, null); supplierName.ResetText(); contactDetails.ResetText(); }
private void btnSave_Click(object sender, EventArgs e) { if (getSaved != null) { getSaved.Invoke(this, e); } }
private void supplierTable_CellEndEdit(object sender, DataGridViewCellEventArgs e) { var dgt = (DataGridView)sender; var current = dgt.CurrentCell.Value.ToString(); ///name if ((e.ColumnIndex == 1 && current == targetSupplier.Name) || (e.ColumnIndex == 2 && current == targetSupplier.ContactDetails)) { return; } using (var p = new POSEntities()) { var id = (int)(dgt.Rows[e.RowIndex].Cells[0].Value); var supp = p.Suppliers.FirstOrDefault(x => x.Id == id); if (e.ColumnIndex == 1) { supp.Name = dgt.Rows[e.RowIndex].Cells[1].Value.ToString(); } else if (e.ColumnIndex == 2) { supp.ContactDetails = dgt.Rows[e.RowIndex].Cells[2].Value.ToString(); } OnSave?.Invoke(this, null); p.SaveChanges(); MessageBox.Show("Edit saved"); } resetAutoComplete(); }
private void btnSave_Click(object sender, EventArgs e) { if (rbInHouse.Checked) { partToUpdate = new Inhouse { PartId = int.Parse(tbID.Text), Name = tbName.Text, InStock = int.Parse(tbInventory.Text), Min = int.Parse(tbMinQuantity.Text), Max = int.Parse(tbMaxQuantity.Text), MachineID = int.Parse(tbSource.Text), Price = decimal.Parse(tbPrice.Text) }; } else { partToUpdate = new Outsourced { PartId = int.Parse(tbID.Text), Name = tbName.Text, InStock = int.Parse(tbInventory.Text), Min = int.Parse(tbMinQuantity.Text), Max = int.Parse(tbMaxQuantity.Text), CompanyName = tbSource.Text, Price = decimal.Parse(tbPrice.Text) }; } OnSave?.Invoke(this, EventArgs.Empty); this.Close(); }
private void saveBtn_Click(object sender, EventArgs e) { if (!canSave()) { return; } using (var p = new POSEntities()) { var add = address.Text.Trim(); var cont = contact.Text.Trim(); Customer c = new Customer(); c.Name = name.Text.Trim(); c.Address = add == string.Empty ? null : add; c.ContactDetails = cont == string.Empty ? null : cont; p.Customers.Add(c); p.SaveChanges(); OnSave?.Invoke(this, null); } this.Tag = name.Text.Trim(); DialogResult = DialogResult.OK; this.Close(); }
internal static bool SaveSaveData(ManSaveGame.SaveData saveData, string filePath) { FlagSave(saveData); var saveEvent = new SaveGameEvent(saveData, filePath); OnSave?.Invoke(saveEvent); return(saveEvent.CancelSave); }
private void Awake() { closeButton.onClick.AddListener(() => Hide()); saveButton.onClick.AddListener(() => { OnSave?.Invoke(this, rewardForm.GetData()); //SetActive(false); }); }
public bool Save(BacktraceDatabaseRecord record) { if (OnSave != null) { return(OnSave.Invoke(record)); } return(true); }
public JSON Save() { JSON data = new JSON(); OnSave?.Invoke(data); OnSaveDone?.Invoke(data); return(data); }
public void SaveModel() { SaveToJSON(); if (OnSave != null) { OnSave.Invoke(); } }
private void Adv_ItemSelected(object sender, ItemInfoHolder e) { Console.WriteLine("add item here"); using (var p = new POSEntities()) { var targetSale = p.Sales.FirstOrDefault(x => x.Id == sale.Id); var newSoldItem = new SoldItem(); InventoryItem Inv = null; if (!string.IsNullOrEmpty(e.Serial)) { Inv = p.InventoryItems.FirstOrDefault(x => x.SerialNumber == e.Serial); } else { Inv = p.InventoryItems.FirstOrDefault(x => x.Product.Item.Name == e.Name && x.Product.Supplier.Name == e.Supplier); } //Console.WriteLine(Inv.Product.Item.Name); newSoldItem.SaleId = sale.Id; newSoldItem.Product = p.Products.FirstOrDefault(x => x.Item.Name == e.Name && x.Supplier.Name == e.Supplier); newSoldItem.SerialNumber = e.Serial; int rem = -1; newSoldItem.Quantity = calculateQuantity(e.Quantity, Inv.Quantity, out rem); newSoldItem.ItemPrice = e.SellingPrice; newSoldItem.Discount = e.discount; Console.WriteLine(rem); if (rem == 0) { p.InventoryItems.Remove(Inv); } else if (rem > 0) { Inv.Quantity = rem; } p.SoldItems.Add(newSoldItem); p.SaveChanges(); OnSave?.Invoke(this, null); itemsTable.Rows.Add(newSoldItem.Id, newSoldItem.Product.Item.Name, newSoldItem.SerialNumber, newSoldItem.Quantity, string.Format("₱ {0:n}", newSoldItem.ItemPrice), newSoldItem.Discount, string.Format("₱ {0:n}", (newSoldItem.Quantity * newSoldItem.ItemPrice) * ((100 - newSoldItem.Discount) / 100)), newSoldItem.Product.Supplier?.Name, "Return Item"); } }
public virtual int Save() { var originaltracker = Tracker; OnSave?.Invoke(this, originaltracker); var result = _context.SaveChanges(); OnAfterSave?.Invoke(this, originaltracker, Tracker); return(result); }
public void FireOnSave(DispenseCartControlViewModel state) { var args = new DispenseCartSaveEventArgs(); args.Items = state.ItemsToCheckout; args.SubTotal = state.SubTotal; args.Discount = state.Discount; args.Vat = state.Vat; args.Total = state.Total; OnSave?.Invoke(this, args); }
private void btnSaveProduct_Click(object sender, EventArgs e) { ProductToUpdate.ProductId = int.Parse(tbID.Text); ProductToUpdate.Name = tbName.Text; ProductToUpdate.Price = decimal.Parse(tbPrice.Text); ProductToUpdate.InStock = int.Parse(tbInventory.Text); ProductToUpdate.Max = int.Parse(tbMax.Text); ProductToUpdate.Min = int.Parse(tbMin.Text); OnSave?.Invoke(this, EventArgs.Empty); this.Close(); }
/// <summary> /// On Editor Save /// </summary> private static string[] OnWillSaveAssets(string[] paths) { // Prefab creation enforces SaveAsset and this may cause unwanted dir cleanup if (paths.Length == 1 && (paths[0] == null || paths[0].EndsWith(".prefab"))) { return(paths); } OnSave?.Invoke(); return(paths); }
public TopPalette(Camera camera, IScreenParentObject parent = null, MyTexture2D texture = null) : base(camera, PalettePosition, PaletteSize, parent, texture) { CreatePaletteButton("Save", t => OnSave?.Invoke()); CreatePaletteButton("Load", t => OnLoad?.Invoke()); CreatePaletteButton("Group", t => OnGroup?.Invoke()); CreatePaletteButton("Ungroup", t => OnUnGroup?.Invoke()); CreatePaletteButton("Remove", t => OnRemove?.Invoke()); CreatePaletteButton("Undo remove", t => OnUndoRemove?.Invoke()); CreatePaletteButton("Duplicate", t => OnDuplicate?.Invoke()); ColorChanger.ResetColor(Color.LightGray); }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { int id, inStock, min, max, machineID; string name, companyName = tbSource.Text; decimal price; int.TryParse(tbID.Text, out id); int.TryParse(tbInventory.Text, out inStock); int.TryParse(tbMinQuantity.Text, out min); int.TryParse(tbMaxQuantity.Text, out max); if (!int.TryParse(tbSource.Text, out machineID)) { companyName = tbSource.Text; } name = tbName.Text; price = decimal.Parse(tbPrice.Text, CultureInfo.InvariantCulture); if (rbInHouse.Checked) { PartToCreate = new Inhouse { PartId = id, Name = name, InStock = inStock, Min = min, Max = max, Price = price, MachineID = machineID, }; } else { PartToCreate = new Outsourced { PartId = id, Name = name, InStock = inStock, Min = min, Max = max, Price = price, CompanyName = companyName }; } OnSave?.Invoke(this, EventArgs.Empty); this.ResetText(); this.Close(); } }
private void Save() { if (_spec == null) { _spec = new Specification(); } _spec.CreationDate = dateTimePickerSpecDate.Value; _spec.From = comboBoxEntityFrom.SelectedItem != null ? (Entity)comboBoxEntityFrom.SelectedItem : null; _spec.To = comboBoxEntityTo.SelectedItem != null ? (Entity)comboBoxEntityTo.SelectedItem : null; _spec.Id = textBoxSpecId.Text; _spec.MaxDays = int.Parse(textBoxOfferDays.Text); _spec.Save(); OnSave?.Invoke(null); }
/// <summary> /// 保存数据 /// </summary> /// <param name="context"></param> protected void Save(EditContext context) { var valid = OnSave?.Invoke((TItem)context.Model) ?? false; var option = new ToastOption(); option.Category = valid ? ToastCategory.Success : ToastCategory.Error; option.Title = "保存数据"; option.Content = $"保存数据{(valid ? "成功" : "失败")}, {Math.Ceiling(option.Delay / 1000.0)} 秒后自动关闭"; Toast?.Show(option); if (valid) { EditModal?.Toggle(); Query(); } }
private void ButtonSave_Click(object sender, RoutedEventArgs e) { //Reset the error list errors.Clear(); //Execute the validations if (ExecuteValidations()) { //Password is not bound for safety issues, therefore we have to do it by code if (!string.IsNullOrEmpty(txtPassword.Password)) { Entity.ChangePassword = true; Entity.Password = txtPassword.Password; } //Although we work binding an object to the XAML, we did not want to give //to the view for edit the actual object being changed, so when we set //the Entity, the datacontext is loaded with a copy of the object //and when the user finally saves it, we set the properties //of our entity (that is the one shown in the grid) with the values from the //view (DataContext). User changedUser = (User)fieldsGrid.DataContext; Entity.Id = changedUser.Id; Entity.IdUserType = changedUser.IdUserType; Entity.UserType = changedUser.UserType; Entity.Name = changedUser.Name; Entity.Username = changedUser.Username; //It could be bound through the interface, but what I want to do is to //allow that the errors are shown here ResultOperation result = userModel.Save(Entity); if (result.Success) { OnSave?.Invoke(); } else { errors.AddRange(result.Errors); } } if (errors.Any()) { lblErrors.Content = UIHelper.GetStringFromList(errors); } }
private void Awake() { if (nameField != null) { nameField.onValueChanged.AddListener(x => ValidateSaveButton()); } if (saveManager != null) { SaveManager = saveManager.NeedComponent <ILevelEditorSaveManager>(); SaveManager.OnLevelLoaded += OnLevelLoaded; } if (saveButton != null) { saveButton.onClick.AddListener(() => { if (SaveManager != null) { SaveManager.SaveLevel(nameField.text); } OnSave?.Invoke(nameField.text); if (closeOnSave) { Close(); } //TODO: Ask before override. LevelEditorLogger.LogTodo("Ask before override"); }); } if (cancelButton != null) { cancelButton.onClick.AddListener(Close); } if (closeButton != null) { closeButton.onClick.AddListener(Close); } ValidateSaveButton(); }
private void Save() { _bill.Owner = (EntityFinancialDecorator)comboBoxOwner.SelectedItem; _bill.Client = (EntityFinancialDecorator)comboBoxClients.SelectedItem; _bill.CreateDate = dateTimePickerCreation.Value; _bill.LimitDate = dateTimePickerLimit.Value; _bill.PayDate = dateTimePickerPayDate.Value; _bill.BankDetail = textBoxBank.Text; _bill.Products.Clear(); _bill.Color = buttonColor.BackColor; foreach (DataGridViewRow item in _dataGridViewProducts.Rows) { _bill.Products.Add((Product)item.Tag); } _intFin.CurrentActivity?.Bills.Add(_bill); OnSave?.Invoke(null); }