Ejemplo n.º 1
0
        private void SaveAsTasMenuItem_Click(object sender, EventArgs e)
        {
            var filename = CurrentTasMovie.Filename;

            if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
            {
                filename = SuggestedTasProjName();
            }

            var file = ToolHelpers.GetTasProjSaveFileFromUser(filename);

            if (file != null)
            {
                CurrentTasMovie.Filename = file.FullName;

                if (_exiting)
                {
                    CurrentTasMovie.Save();
                }
                else
                {
                    _saveBackgroundWorker.RunWorkerAsync();
                }

                Settings.RecentTas.Add(CurrentTasMovie.Filename);
                SetTextProperty();
            }
        }
Ejemplo n.º 2
0
        private void SaveTas()
        {
            if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
                CurrentTasMovie.Filename == DefaultTasProjName())
            {
                SaveAsTas();
            }
            else
            {
                _autosaveTimer?.Stop();
                GlobalWin.Sound.StopSound();
                MessageStatusLabel.Text = "Saving...";
                Cursor = Cursors.WaitCursor;
                Update();
                CurrentTasMovie.Save();
                if (Settings.AutosaveInterval > 0)
                {
                    _autosaveTimer?.Start();
                }

                MessageStatusLabel.Text = "File saved.";
                Settings.RecentTas.Add(CurrentTasMovie.Filename);
                Cursor = Cursors.Default;
                GlobalWin.Sound.StartSound();
            }
        }
Ejemplo n.º 3
0
        private void SaveAsTas(object sender, EventArgs e)
        {
            _autosaveTimer.Stop();
            var filename = CurrentTasMovie.Filename;

            if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
            {
                filename = SuggestedTasProjName();
            }

            var file = SaveFileDialog(
                filename,
                PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
                "Tas Project Files",
                "tasproj");

            if (file != null)
            {
                CurrentTasMovie.Filename = file.FullName;
                MessageStatusLabel.Text  = "Saving...";
                this.Cursor = Cursors.WaitCursor;
                Update();
                CurrentTasMovie.Save();
                Settings.RecentTas.Add(CurrentTasMovie.Filename);
                SetTextProperty();
                MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
                this.Cursor             = Cursors.Default;
            }
            // keep insisting
            if (Settings.AutosaveInterval > 0)
            {
                _autosaveTimer.Start();
            }
        }
Ejemplo n.º 4
0
        private void InitializeSaveWorker()
        {
            if (_saveBackgroundWorker != null)
            {
                _saveBackgroundWorker.Dispose();
                _saveBackgroundWorker = null;                 // Idk if this line is even useful.
            }

            _saveBackgroundWorker = new BackgroundWorker();
            _saveBackgroundWorker.WorkerReportsProgress = true;
            _saveBackgroundWorker.DoWork += (s, e) =>
            {
                this.Invoke(() => this.MessageStatusLabel.Text   = "Saving " + Path.GetFileName(CurrentTasMovie.Filename) + "...");
                this.Invoke(() => this.SavingProgressBar.Visible = true);
                CurrentTasMovie.Save();
            };

            _saveBackgroundWorker.ProgressChanged += (s, e) =>
            {
                SavingProgressBar.Value = e.ProgressPercentage;
            };

            _saveBackgroundWorker.RunWorkerCompleted += (s, e) =>
            {
                this.Invoke(() => this.MessageStatusLabel.Text   = Path.GetFileName(CurrentTasMovie.Filename) + " saved.");
                this.Invoke(() => this.SavingProgressBar.Visible = false);

                InitializeSaveWorker();                 // Required, or it will error when trying to report progress again.
            };

            if (CurrentTasMovie != null)             // Again required. TasMovie has a separate reference.
            {
                CurrentTasMovie.NewBGWorker(_saveBackgroundWorker);
            }
        }
Ejemplo n.º 5
0
        private void SaveAsTasMenuItem_Click(object sender, EventArgs e)
        {
            var filename = CurrentTasMovie.Filename;

            if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
            {
                filename = SuggestedTasProjName();
            }

            var file = SaveFileDialog(
                filename,
                PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
                "Tas Project Files",
                "tasproj");

            if (file != null)
            {
                CurrentTasMovie.Filename = file.FullName;

                if (_exiting)
                {
                    CurrentTasMovie.Save();
                }
                else
                {
                    _saveBackgroundWorker.RunWorkerAsync();
                }

                Settings.RecentTas.Add(CurrentTasMovie.Filename);
                SetTextProperty();
            }
        }
Ejemplo n.º 6
0
 private void SaveTasMenuItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
         CurrentTasMovie.Filename == DefaultTasProjName())
     {
         SaveAsTasMenuItem_Click(sender, e);
     }
     else
     {
         CurrentTasMovie.Save();
         Settings.RecentTas.Add(CurrentTasMovie.Filename);
     }
 }
Ejemplo n.º 7
0
        private void SaveAsTas()
        {
            _autosaveTimer.Stop();
            GlobalWin.Sound.StopSound();
            ClearLeftMouseStates();
            var filename = CurrentTasMovie.Filename;

            if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
            {
                filename = SuggestedTasProjName();
            }

            var file = SaveFileDialog(
                filename,
                Config.PathEntries.MovieAbsolutePath(),
                "Tas Project Files",
                "tasproj",
                this
                );

            if (file != null)
            {
                CurrentTasMovie.Filename = file.FullName;
                MessageStatusLabel.Text  = "Saving...";
                Cursor = Cursors.WaitCursor;
                Update();
                CurrentTasMovie.Save();
                Settings.RecentTas.Add(CurrentTasMovie.Filename);
                UpdateWindowTitle();
                MessageStatusLabel.Text = "File saved.";
                Cursor = Cursors.Default;
            }

            // keep insisting
            if (Settings.AutosaveInterval > 0)
            {
                _autosaveTimer.Start();
            }

            MainForm.SetWindowText();
            GlobalWin.Sound.StartSound();
        }
Ejemplo n.º 8
0
 private void SaveTasMenuItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
         CurrentTasMovie.Filename == DefaultTasProjName())
     {
         SaveAsTasMenuItem_Click(sender, e);
     }
     else
     {
         if (_exiting)
         {
             CurrentTasMovie.Save();
         }
         else
         {
             _saveBackgroundWorker.RunWorkerAsync();
         }
         Settings.RecentTas.Add(CurrentTasMovie.Filename);
     }
 }
Ejemplo n.º 9
0
 private void SaveTasMenuItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
         CurrentTasMovie.Filename == DefaultTasProjName())
     {
         SaveAsTasMenuItem_Click(sender, e);
     }
     else
     {
         _autosaveTimer.Stop();
         MessageStatusLabel.Text = "Saving...";
         this.Cursor             = Cursors.WaitCursor;
         Update();
         if (_autosaveAppendFilenamePending)
         {
             // temp filename
             var ext = CurrentTasMovie.PreferredExtension;
             CurrentTasMovie.Filename = CurrentTasMovie.Filename.Replace(ext, "backup." + ext);
         }
         CurrentTasMovie.Save();
         if (Settings.AutosaveInterval > 0)
         {
             _autosaveTimer.Start();
         }
         MessageStatusLabel.Text = CurrentTasMovie.Name + " saved.";
         if (_autosaveAppendFilenamePending)
         {
             // switch back to original
             CurrentTasMovie.Filename = CurrentTasMovie.Filename.Replace("backup.", "");
             // we should only arrive here if changes were true
             // and saving to a different file clears changes
             // so assuming the original file remains unsaved, keep changes flagged
             CurrentTasMovie.FlagChanges();
         }
         else
         {
             Settings.RecentTas.Add(CurrentTasMovie.Filename);
         }
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 10
0
 private void SaveTas(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
         CurrentTasMovie.Filename == DefaultTasProjName())
     {
         SaveAsTas(sender, e);
     }
     else
     {
         _autosaveTimer.Stop();
         MessageStatusLabel.Text = "Saving...";
         this.Cursor             = Cursors.WaitCursor;
         Update();
         CurrentTasMovie.Save();
         if (Settings.AutosaveInterval > 0)
         {
             _autosaveTimer.Start();
         }
         MessageStatusLabel.Text = CurrentTasMovie.Name + " saved.";
         Settings.RecentTas.Add(CurrentTasMovie.Filename);
         this.Cursor = Cursors.Default;
     }
 }