Пример #1
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                delta = DeltaParser.ReadDelta(Settings.Default.SourceFile, Settings.Default.TargetFile, Settings.Default.DeltaFile);

                deltaVC     = new DeltaViewController(delta);
                view.Source = deltaVC.View;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown();
            }
        }
Пример #2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                string src = Utils.BrowseForFile("Select the Source file");
                string tgt = Utils.BrowseForFile("Select the Target file");
                string dlt = Utils.BrowseForFile("Select the Changes file");

                // delta = DeltaParser.ReadDelta(Settings.Default.SourceFile, Settings.Default.TargetFile, Settings.Default.DeltaFile);
                delta = DeltaParser.ReadDelta(src, tgt, dlt);

                deltaVC     = new DeltaViewController(delta);
                view.Source = deltaVC.View;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown();
            }
        }
Пример #3
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            // In case the user just typed in the file names and didn't browse, we need to copy
            // the textbox values into our public properties

            if (!SourceFileName.EndsWith(SourceFileNameTextBox.Text))
            {
                SourceFileName = SourceFileNameTextBox.Text;
            }

            if (!TargetFileName.EndsWith(TargetFileNameTextBox.Text))
            {
                TargetFileName = TargetFileNameTextBox.Text;
            }

            if (!ChangesFileName.EndsWith(ChangesFileNameTextBox.Text))
            {
                ChangesFileName = ChangesFileNameTextBox.Text;
            }

            try
            {
                delta = DeltaParser.ReadDelta(SourceFileName, TargetFileName, ChangesFileName);
            }
            catch (System.IO.FileNotFoundException ex)
            {
                MessageBox.Show(string.Format("Unable to open files: {0}", ex.Message), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (delta != null)
            {
                this.Close();
            }
        }