Ejemplo n.º 1
0
 /// <summary>
 /// Save into a file
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void appSaveItem_Click(object sender, EventArgs e)
 {
     if (FunLab.Save(ref this.path, ref this.fileName, po))
     {
         this.Text = "Editor - " + this.fileName;
     }
 }
Ejemplo n.º 2
0
 /// <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);
     }
 }
Ejemplo n.º 3
0
 /// <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);
         }
     }
 }