Example #1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (project == null)
            {
                project = new ClipSynthProject();
            }

            var result = saveDialog.ShowDialog(this);
            if (result.GetValueOrDefault())
            {
                project.Path = saveDialog.FileName;
                project.Dirty = false;
                ClipSynthProject.Save(ref project);
            }
        }
Example #2
0
        public MainWindow()
        {
            project = null;

            settings = new ClipSynthSettings();
            ClipSynthSettings.Load(ref settings);

            // Validate settings
            if (!Directory.Exists(settings.Folder))
            {
                settings.Folder = String.Empty;
            }

            if (!File.Exists(settings.Project))
            {
                settings.Project = String.Empty;
            }

            args = Environment.GetCommandLineArgs();
            ToolsFolder = IOPath.GetDirectoryName(args[0]);
            VirtualDubPath = IOPath.Combine(ToolsFolder, @"VirtualDub\vdub.exe");
            VirtualDubGUIPath = IOPath.Combine(ToolsFolder, @"VirtualDub\VirtualDub.exe");

            InitializeComponent();

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            Title = String.Format("ClipSynth v{0}", version);

            TabControl.SelectionChanged += TabControl_SelectionChanged;

            #region Command line argument(s)

            if (args.Length > 1)
            {
                var path = args[1];

                if (Directory.Exists(path))
                {
                    settings.Folder = path;
                    settings.Mode = ClipSynthMode.Images;
                }
                else if (ClipSynthProject.TryLoad(path, ref project))
                {
                    settings.Project = path;
                    settings.Mode = ClipSynthMode.Movies;
                }
            }

            #endregion

            #region Dialogs and windows

            folderDialog = new FolderBrowserDialog();
            folderDialog.Description = "Select the root folder you wish to operate on.";

            openDialog = new OpenFileDialog();
            openDialog.DefaultExt = ".clipsynth";
            openDialog.Filter = "ClipSynth projects|*.clipsynth";
            openDialog.Title = "Select the ClipSynth project file to load";

            openMovieDialog = new OpenFileDialog();
            openMovieDialog.DefaultExt = ".avi";
            openMovieDialog.Filter = "ClipSynth supported movie files|*.avi";
            openMovieDialog.Title = "Select the movie file to load";

            openSoundtrackDialog = new OpenFileDialog();
            openSoundtrackDialog.DefaultExt = ".wav";
            openSoundtrackDialog.Filter = "ClipSynth supported soundtrack files (*.wav, *.mp3)|*.wav;*.mp3";
            openSoundtrackDialog.Title = "Select the soundtrack file to load";

            saveDialog = new SaveFileDialog();
            saveDialog.DefaultExt = ".clipsynth";
            saveDialog.Filter = "ClipSynth projects|*.clipsynth";
            saveDialog.Title = "Choose a filename for the current ClipSynth project";

            favorites = new Favorites();
            favorites.OKButton.Click += Favorites_OKButton_Click;

            #endregion

            TabControl.SelectedItem = settings.Mode == ClipSynthMode.Images ? this.FindName("ImagesTabItem") : this.FindName("MoviesTabItem");
            Refresh();
        }