예제 #1
0
 /// <summary>
 ///     Attempts to save a given workspace.  Shows a save as dialog if the 
 ///     workspace does not already have a path associated with it
 /// </summary>
 /// <param name="workspace">The workspace for which to show the dialog</param>
 internal void ShowSaveDialogIfNeededAndSave(WorkspaceModel workspace)
 {
     // crash sould always allow save as
     if (workspace.FileName != null && !dynSettings.Controller.IsCrashing)
     {
         workspace.Save();
     }
     else
     {
         var fd = this.GetSaveDialog(workspace);
         if (fd.ShowDialog() == DialogResult.OK)
         {
             workspace.SaveAs(fd.FileName);
         }
     }
 }
예제 #2
0
        /// <summary>
        ///     Attempts to save a given workspace.  Shows a save as dialog if the 
        ///     workspace does not already have a path associated with it
        /// </summary>
        /// <param name="workspace">The workspace for which to show the dialog</param>
        /// <returns>true if save was successful, false otherwise</returns>
        internal bool ShowSaveDialogIfNeededAndSave(WorkspaceModel workspace)
        {
            // crash sould always allow save as
            if (!String.IsNullOrEmpty(workspace.FileName) && !DynamoModel.IsCrashing)
            {
                workspace.Save(EngineController.LiveRunnerRuntimeCore);
                return true;
            }
            else
            {
                //TODO(ben): We still add a cancel button to the save dialog if we're crashing
                // sadly it's not usually possible to cancel a crash

                var fd = this.GetSaveDialog(workspace);
                if (fd.ShowDialog() == DialogResult.OK)
                {
                    workspace.SaveAs(fd.FileName, EngineController.LiveRunnerRuntimeCore);
                    return true;
                }
            }

            return false;
        }
예제 #3
0
 /// <summary>
 ///     Attempts to save a given workspace.  Shows a save as dialog if the 
 ///     workspace does not already have a path associated with it
 /// </summary>
 /// <param name="workspace">The workspace for which to show the dialog</param>
 internal void ShowSaveDialogIfNeededAndSave(WorkspaceModel workspace)
 {
     if (workspace.FileName != null)
     {
         workspace.Save();
     }
     else
     {
         var fd = this.GetSaveDialog(workspace);
         if (fd.ShowDialog() == DialogResult.OK)
         {
             workspace.SaveAs(fd.FileName);
         }
     }
 }
예제 #4
0
 /// <summary>
 ///     Attempts to save a given workspace.  Shows a save as dialog if the 
 ///     workspace does not already have a path associated with it
 /// </summary>
 /// <param name="workspace">The workspace for which to show the dialog</param>
 internal void ShowSaveDialogIfNeededAndSave(WorkspaceModel workspace)
 {
     // crash sould always allow save as
     if (workspace.FileName != String.Empty && !DynamoModel.IsCrashing)
     {
         workspace.Save();
     }
     else
     {
         var fd = this.GetSaveDialog(workspace);
         if (fd.ShowDialog() == DialogResult.OK)
         {
             workspace.SaveAs(fd.FileName);
         }
     }
 }