コード例 #1
0
        /// <summary>Save all changes.</summary>
        /// <returns>True if file was saved.</returns>
        public bool Save()
        {
            // Need to hide the right hand panel because some views may not have saved
            // their contents until they get a 'Detach' call.
            try
            {
                HideRightHandPanel();
            }
            catch (Exception err)
            {
                MainPresenter.ShowError(err);
            }

            if (string.IsNullOrEmpty(ApsimXFile.FileName))
            {
                SaveAs();
            }

            if (!string.IsNullOrEmpty(ApsimXFile.FileName))
            {
                ApsimXFile.Write(ApsimXFile.FileName);
                MainPresenter.ShowMessage(string.Format("Successfully saved to {0}", StringUtilities.PangoString(ApsimXFile.FileName)), Simulation.MessageType.Information);
                return(true);
            }

            try
            {
                ShowRightHandPanel();
            }
            catch (Exception err)
            {
                MainPresenter.ShowError(err);
            }

            return(false);
        }
コード例 #2
0
 /// <summary>Do the actual write to the file</summary>
 /// <param name="fileName">Path to which the file will be saved.</param>
 public void WriteSimulation(string fileName)
 {
     ApsimXFile.ExplorerWidth = TreeWidth;
     ApsimXFile.Write(fileName);
     CommandHistory.Save();
 }