Ejemplo n.º 1
0
        private void MnuOpen_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var _o = new OpenFileDialog()
                {
                    Filter     = "XML Documents|*.xml",
                    DefaultExt = ".xml",
                };
                var _result = _o.ShowDialog();

                if (_result == true)
                {
                    var _dlg = new ImportDialog
                    {
                        Owner = this
                    };

                    _dlg.ShowDialog();

                    if (!_dlg.Append)
                    {
                        LoadingFile = true;
                        Tabs.Items.Clear();
                        MnuQueryList.Items.Clear();
                        Fingerprints.Clear();
                    }


                    var _h = new XmlDocumentHistory();
                    _h.RegenerateTab += _xml_RegenerateTab;
                    _h.RecoverTabs(_o.FileName, Fingerprints);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(DevMode ? ex.ToString() : ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                LoadingFile = false;
            }
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            LoadingFile = false;

            var _newTabCmd = new RoutedCommand();

            _newTabCmd.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(_newTabCmd, NewTabClick));

            var _stripCmd = new RoutedCommand();

            _stripCmd.InputGestures.Add(new KeyGesture(Key.F3));
            CommandBindings.Add(new CommandBinding(_stripCmd, StripClick));

            var _prepCmd = new RoutedCommand();

            _prepCmd.InputGestures.Add(new KeyGesture(Key.F2));
            CommandBindings.Add(new CommandBinding(_prepCmd, PrepareClick));

            var _clCmd = new RoutedCommand();

            _clCmd.InputGestures.Add(new KeyGesture(Key.L, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(_clCmd, CopyLowerClick));

            var _cuCmd = new RoutedCommand();

            _cuCmd.InputGestures.Add(new KeyGesture(Key.U, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(_cuCmd, CopyUpperClick));

            var _closeTcmd = new RoutedCommand();

            _closeTcmd.InputGestures.Add(new KeyGesture(Key.D, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(_closeTcmd, CloseCurrentTabClick));

            var _pasteTcmd = new RoutedCommand();

            _pasteTcmd.InputGestures.Add(new KeyGesture(Key.V, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(_pasteTcmd, PasteClick));

            Fingerprints = new List <Guid>();

            var _xml = new XmlDocumentHistory();

            _xml.RegenerateTab += _xml_RegenerateTab;

            if (_xml.HistoryTabCount > 0)
            {
                _xml.RecoverTabs();
            }
            else // Start empty session...
            {
                AddTab();
                CurrentEditor.InputFocus();
            }

            MnuDeleteHistory.IsEnabled = ProcessedTabs > 0 || XmlDocumentHistory.HistoryExists;

            // Scale to primary screen size to avoid oversize windows on that small-screen laptop I'm
            // using for work these days. --Will Kraft (3/22/2020).
            Width  = SystemParameters.PrimaryScreenWidth / 1.8;
            Height = SystemParameters.PrimaryScreenHeight / 1.4;
        }