Exemple #1
0
 /// <summary>
 /// Save current workspace
 /// </summary>
 private void WorkspaceSaveMenuItem(object sender, EventArgs e)
 {
     if (saveWk.ShowDialog() == DialogResult.OK)
     {
         ClassWorkspace.Save(saveWk.FileName);
     }
 }
Exemple #2
0
        /// <summary>
        /// Load a workspace selected by the last recently used menu
        /// </summary>
        private void WorkspaceLoadLruMenuItem(object sender, EventArgs e)
        {
            string name = (sender as ToolStripMenuItem).Tag as string;

            // Save existing workspace before trying to load a new one
            if (ClassWorkspace.Save(null))
            {
                if (ClassWorkspace.Load(name))
                {
                    App.DoRefresh();
                }
                else
                {
                    if (MessageBox.Show("The specified workspace file cannot be loaded, or the loading was cancelled." + Environment.NewLine + "Do you want to remove it from the list of recently used workspaces?",
                                        "Load Workspace", MessageBoxButtons.YesNo, MessageBoxIcon.Error) != DialogResult.Yes)
                    {
                        return;
                    }
                    // Remove the workspace file from the LRU list
                    var lru = ClassWorkspace.GetLRU();
                    lru.Remove(name);
                    ClassWorkspace.SetLRU(lru);
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// Select and load a specific workspace
 /// </summary>
 private void WorkspaceLoadMenuItem(object sender, EventArgs e)
 {
     if (loadWk.ShowDialog() == DialogResult.OK)
     {
         // Save existing workspace before trying to load a new one
         if (ClassWorkspace.Save(null))
         {
             if (ClassWorkspace.Load(loadWk.FileName))
             {
                 App.DoRefresh();
             }
         }
     }
 }
Exemple #4
0
 private void FormMainDragDrop(object sender, DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
     if (files.Count() == 1 && Path.GetExtension(files[0]) == ".giw")
     {
         // Save the current workspace and load the one user dropped in
         if (ClassWorkspace.Save(null))
         {
             if (ClassWorkspace.Load(files[0]))
             {
                 App.DoRefresh();
             }
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// Create a new workspace at the specified (workspace) file location
 /// </summary>
 private void WorkspaceCreateMenuItem(object sender, EventArgs e)
 {
     // Save existing workspace before trying to create a new one
     if (ClassWorkspace.Save(null))
     {
         // Ask user to select a new workspace file name
         if (createWk.ShowDialog() == DialogResult.OK)
         {
             // Create a new workspace by saving an empty one and then reloading it
             ClassWorkspace.Clear();
             ClassWorkspace.Save(createWk.FileName);
             ClassWorkspace.Load(createWk.FileName);
             App.DoRefresh();
         }
     }
 }
Exemple #6
0
        /// <summary>
        /// Form is closing
        /// </summary>
        private void FormMainFormClosing(object sender, FormClosingEventArgs e)
        {
            // Remove the print status handler
            App.PrintStatusMessage -= PrintStatus;

            // Store geometry of _this_ window
            ClassWinGeometry.Save(this);

            // Save custom tools to their default location
            App.CustomTools.Save(DefaultCustomToolsFile);

            // Close the log windown manually in order to save its geometry
            App.Log.FormClosing -= LogWindowToolStripMenuItemClick;
            App.Log.Close();

            // Save windows geometry database
            ClassWinGeometry.SaveGeometryDatabase();

            // Save current workspace
            ClassWorkspace.Save(null);

            // Remove all outstanding temp files
            ClassGlobals.RemoveTempFiles();
        }