Esempio n. 1
0
        private void SaveProject()
        {
            // commit data to CurrentProject
            SaveToCurrentProject();

            bool success;

            string data = XmlHelper.Serialize(CurrentProject, out success);

            if (success)
            {
                // actual save
                File.WriteAllText(CurrentProject.DataFile, data);

                MessageBox.Show(
                    "Project saved.", "Save",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                StamperLiveData.SendProjectChanged();
            }
            else
            {
                MessageBox.Show(
                    "A problem occured serializing the project data.",
                    "Save error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void DrivesForm_Load(object sender, EventArgs e)
        {
            LoadModeFromLiveData();
            LoadSessionLogFromLiveData();

            DriveStamperUI.Instance.OnActivityChanged += ActivityChanged;

            StamperLiveData.OnProjectChanged    += ProjectChanged;
            StamperLiveData.OnSessionLogChanged += SessionLogChanged;
            StamperLiveData.SendProjectChanged();

            StamperLiveData.OnDrivesUpdated += DrivesUpdated;
            DriveStamperUI.Instance.UpdateDrives();
        }
 public static void LoadProject(string file)
 {
     if (string.IsNullOrWhiteSpace(file) || !File.Exists(file))
     {
         StamperLiveData.Project = new Project();
         StamperLiveData.Project.SetDefaults();
         StamperLiveData.SendProjectChanged();
         StamperLiveData.SetLastProjectName(string.Empty);
     }
     else
     {
         StamperLiveData.Project = XmlHelper.Deserialize <Project>(File.ReadAllText(file));
         StamperLiveData.SendProjectChanged();
         StamperLiveData.SetLastProjectName(file);
     }
 }