/// <summary> /// Save into an another file /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void appSaveAsItem_Click(object sender, EventArgs e) { if (FunLab.SaveAs(ref this.path, ref this.fileName, po)) { this.Text = "Editor - " + this.fileName; } }
/// <summary> /// Load a file /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void appLoadItem_Click(object sender, EventArgs e) { if (FunLab.IsDirty) { DialogResult dr = MessageBox.Show("Save current ?", "Not saved", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { FunLab.Save(ref this.path, ref this.fileName, po); } } try { if (FunLab.Load(ref this.path, ref this.fileName, ref po)) { this.Text = "Editor - " + this.fileName; this.stored.ForEach(x => { x.Close(); x.Dispose(); }); this.stored.Clear(); this.undoPos = 0; vars.BeginUpdate(); vars.Items.Clear(); FunLab.FillVars(vars, po); vars.EndUpdate(); datas.BeginUpdate(); datas.Items.Clear(); FunLab.FillData(datas, po); datas.EndUpdate(); txtSource.Text = po.ToString(); this.AddUndo(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Not loaded", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Copy data /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void editCopyDataItem_Click(object sender, EventArgs e) { if (FunLab.CopyData(datas, po)) { this.AddUndo(); txtSource.Text = po.ToString(); this.Text = "Editor - " + this.fileName + " *"; } }
/// <summary> /// Insert after /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void datasInsertAfterItem_Click(object sender, EventArgs e) { if (FunLab.InsertAfter(datas, po)) { this.AddUndo(); txtSource.Text = po.ToString(); this.Text = "Editor - " + this.fileName + " *"; } }
/// <summary> /// Remove variable /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void varsRemoveItem_Click(object sender, EventArgs e) { if (FunLab.DeleteVariables(vars, po)) { this.AddUndo(); txtSource.Text = po.ToString(); this.Text = "Editor - " + this.fileName + " *"; } }
/// <summary> /// When closing (avoid not saved) /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void Editor_FormClosing(object sender, FormClosingEventArgs e) { if (FunLab.IsDirty) { DialogResult dr = MessageBox.Show("Save current ?", "Not saved", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { FunLab.Save(ref this.path, ref this.fileName, po); } } }
/// <summary> /// Redo /// </summary> /// <param name="sender">sender</param> /// <param name="e">arg</param> private void editRedoItem_Click(object sender, EventArgs e) { if (this.undoPos < this.stored.Count) { MemoryStream mem = this.stored[this.undoPos]; ++this.undoPos; mem.Seek(0, SeekOrigin.Begin); PrinterObject previous = PrinterObject.Load(mem); po = previous as PrinterObject; vars.BeginUpdate(); vars.Items.Clear(); FunLab.FillVars(vars, po); vars.EndUpdate(); datas.BeginUpdate(); datas.Items.Clear(); FunLab.FillData(datas, po); datas.EndUpdate(); txtSource.Text = po.ToString(); FunLab.IsDirty = true; this.Text = "Editor - " + this.fileName + " *"; } }
private void Variable_Load(object sender, EventArgs e) { FunLab.FillVars(vars, pv); }
/// <summary> /// When delete button clicked /// </summary> /// <param name="sender">object</param> /// <param name="e">arg</param> private void btnDelete_Click(object sender, EventArgs e) { this.Hide(); FunLab.DeleteVariables(vars, pv); this.Show(); }
/// <summary> /// When edit button clicked /// </summary> /// <param name="sender">object</param> /// <param name="e">arg</param> private void btnEdit_Click(object sender, EventArgs e) { this.Hide(); FunLab.EditVariable(vars, pv); this.Show(); }
/// <summary> /// When add button clicked /// </summary> /// <param name="sender">object</param> /// <param name="e">arg</param> private void btnAdd_Click(object sender, EventArgs e) { this.Hide(); FunLab.AddNewVariable(vars, pv); this.Show(); }
private void Config_Load(object sender, EventArgs e) { FunLab.FillConfigs(this.configs, this.conf); }