Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += MainWindow_Loaded;
            try
            {
                DbUtil.prepareTables();
                loadSettings();
            }
            catch(Exception e)
            {
                MessageBox.Show("Fail to init database:"+e.Message);
                Environment.Exit(-1);
            }
            this.DataContext = this;
            OpenNewEditorCommand = new OpenEditorCommand(()=>{
                QuickLancherEditor qle = new QuickLancherEditor();
                qle.Owner = this;
                qle.AddedNewQuickCommand += Qle_AddedNewQuickCommand;
                qle.ShowDialog();
            });

            KeyBinding OpenCmdKeyBinding = new KeyBinding(OpenNewEditorCommand,Key.N,ModifierKeys.Control);

            InputBindings.Add(OpenCmdKeyBinding);
            loadQuickCommandsFromDb("");
            commandsList.ItemsSource = quickCommands;
        }
Exemplo n.º 2
0
        private void LoadQuickLaunchers()
        {
            Trace.TraceInformation("loading from database");
            try
            {
                loadSettings();
            }
            catch (Exception e)
            {
                Trace.TraceError(e.StackTrace);
                DialogUtil.showError(this, "Fail to query database:" + e.Message);

                Environment.Exit(-1);
            }

            loadQuickCommandsFromDb("");
            Trace.TraceInformation("loading from database - done");

            this.DataContext     = this;
            OpenNewEditorCommand = new OpenEditorCommand(() =>
            {
                newquickcommand_Click(null, null);
            });

            KeyBinding OpenCmdKeyBinding = new KeyBinding(OpenNewEditorCommand, Key.N, ModifierKeys.Control);

            InputBindings.Add(OpenCmdKeyBinding);

            commandsList.ItemsSource = quickCommands;
        }