Ejemplo n.º 1
0
        public LibraryForm(MainModel Model, JohnsHope.FPlot.Library.Library library)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.Model   = Model;
            oldLibrary   = library;
            this.library = new JohnsHope.FPlot.Library.Library();
            if (oldLibrary == null)
            {
                this.library.Name = Properties.Resources.Library + " " + index++ + ".cs";
            }
            else
            {
                this.library.CopyFrom(oldLibrary);
            }
            hasFile  = File.Exists(this.library.Filename);
            modified = hasFile && File.ReadAllText(this.library.Filename) != this.library.Source;

            Reset();

            editor.TextChanged += Modify;
        }
Ejemplo n.º 2
0
 public void Apply()
 {
     library.Source = editor.Text;
     if (oldLibrary == null)
     {
         Model.Items.Add(library); oldLibrary = library;
     }
     else if (oldLibrary != library)
     {
         Model.Items.Replace(oldLibrary, library); oldLibrary = library;
     }
     if (oldSource != library.Source)
     {
         library.Version = DateTime.Now;
     }
 }