Ejemplo n.º 1
0
        void NodeControl_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            //Logging.Info("NodeControl_PreviewKeyDown");

            if (false)
            {
            }

            else if (Key.Insert == e.Key)
            {
                NodeControl node_control = (NodeControl)sender;

                if (KeyboardTools.IsCTRLDown())
                {
                    object content = new StringNodeContent("Child node");
                    NodeControlAddingByKeyboard.AddChildToNodeControl(node_control, content);
                }
                else
                {
                    NodeControlAddingByKeyboard.AddSiblingToNodeControl(node_control);
                }

                e.Handled = true;
            }
        }
        public void RequestSync(SyncRequest sync_request)
        {
            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail();
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail);
                    scgis.AutoTick();

                    if (scgis.CanRunWithoutIntervention() && !user_wants_intervention)
                    {
                        Sync(scgis);
                    }
                    else
                    {
                        SyncControl sync_control = new SyncControl();
                        sync_control.SetSyncParameters(scgis);
                        sync_control.Show();
                    }
                });
            });
        }
        private void PopupInCiteControl_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (Key.Enter == e.Key)
            {
                if (KeyboardTools.IsCTRLDown())
                {
                    ButtonCiteApart_Click(null, null);
                }
                else
                {
                    ButtonCiteTogether_Click(null, null);
                }

                e.Handled = true;
            }
            else if (Key.S == e.Key && KeyboardTools.IsCTRLDown())
            {
                ButtonSnippet_Click(null, null);

                e.Handled = true;
            }
            else if (Key.F5 == e.Key)
            {
                ButtonRefresh_Click(null, null);

                e.Handled = true;
            }
            else if (Key.Escape == e.Key)
            {
                instance.ObjCheckKeepOpen.IsChecked = false;
                chw.Close();
                e.Handled = true;
            }
            else if (Key.Up == e.Key)
            {
                try
                {
                    --ObjPDFDocuments.SelectedIndex;
                    ObjPDFDocuments.ScrollIntoView(ObjPDFDocuments.SelectedItem);
                    e.Handled = true;
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Key UP");
                }
            }
            else if (Key.Down == e.Key)
            {
                try
                {
                    ++ObjPDFDocuments.SelectedIndex;
                    ObjPDFDocuments.ScrollIntoView(ObjPDFDocuments.SelectedItem);
                    e.Handled = true;
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Key DOWN");
                }
            }
        }
Ejemplo n.º 4
0
        public InitialCatalogueStep(long chatId, IBotClient client) : base(chatId, client)
        {
            CallbackActions.Add("Back", BackAction);

            KeyboardMarkup = new KeyboardMarkup(KeyboardTools.GetCategoriesButtonRow(CommandName));
            NextStep       = new ShowCatalogueProductsStep(ChatId, BotClient);
        }
Ejemplo n.º 5
0
        void PDFReadingControl_KeyUp(object sender, KeyEventArgs e)
        {
            if (false)
            {
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.G)
            {
                JumpToPageNumber.Focus();
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.F)
            {
                SetSearchKeywords();    // *** TODO
                e.Handled = true;
            }

            else if (e.Key == Key.F11)
            {
                ToggleFullScreen();
                e.Handled = true;
            }

            // else forward it to the render control...?
            else
            {
                this.pdf_renderer_control.PDFRendererControl_KeyUp(sender, e);
            }
        }
 private void ButtonSync_Click(object sender, RoutedEventArgs e)
 {
     LibrarySyncManager.Instance.Sync(sync_control_grid_item_set);
     if (!KeyboardTools.IsCTRLDown())
     {
         Close();
     }
 }
Ejemplo n.º 7
0
 void LibraryControl_KeyDown(object sender, KeyEventArgs e)
 {
     if (Key.F == e.Key && KeyboardTools.IsCTRLDown())
     {
         ObjLibraryFilterControl_Search.SearchQuick.FocusSearchArea();
         e.Handled = true;
     }
 }
Ejemplo n.º 8
0
        public override async Task MainAction(BotUpdate update, IBotClient clien)
        {
            NextStep = new SpecifyOrderProductsStep(ChatId, BotClient, Data);

            var keyboard = new KeyboardMarkup(KeyboardTools.GetCategoriesButtonRow(CommandName));

            await SendMessageAsync(Message, keyboardMarkup : keyboard);
        }
Ejemplo n.º 9
0
 void StartPageControl_KeyDown(object sender, KeyEventArgs e)
 {
     if (Key.F == e.Key && KeyboardTools.IsCTRLDown())
     {
         ObjSearch.FocusSearchArea();
         e.Handled = true;
     }
 }
Ejemplo n.º 10
0
        public override async Task MainAction(BotUpdate update, IBotClient clien)
        {
            Data.Category = Catalog.GetCategoryName(update.CallbackData.Split()[1]);
            NextStep      = new SpecifyPhoneStep(ChatId, BotClient, Data);

            var keyboard = new KeyboardMarkup(KeyboardTools.GetProductsButtonRow(Data.Category, CommandName));

            await EditMessageAsync(Message, update.CallbackMessageId, keyboard);
        }
Ejemplo n.º 11
0
        public override async Task DefaultAction(BotUpdate update, IBotClient client)
        {
            Data.Product = Catalog.GetProductName(update.CallbackData.Split()[1]);
            var backButton = new KeyboardMarkup(KeyboardTools.GetOrderAndBackButtons(Data.Product, CommandName));

            NextStep = new ReturnOrOrderStep(Data, update.CallbackData, ChatId, client);

            await EditMessageAsync($"{Message} {Data.Product}", update.CallbackMessageId, backButton);
        }
 void tb_value_KeyDown(object sender, KeyEventArgs e)
 {
     if (KeyboardTools.IsCTRLDown() && Key.OemSemicolon == e.Key)
     {
         TextBox tb = (TextBox)sender;
         tb.Text   = DateTime.Now.ToString("d MMM yyyy");
         e.Handled = true;
     }
 }
        private void GenericLibraryExplorerItemControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (null != item)
            {
                item.GenericLibraryExplorerControl.ToggleSelectItem(item.tag, KeyboardTools.IsCTRLDown() || KeyboardTools.IsShiftDown());
            }

            e.Handled = true;
        }
        public override async Task MainAction(BotUpdate update, IBotClient clien)
        {
            Data.Adress = update.MessageText;
            NextStep    = new FinishOrderStep(ChatId, BotClient, Data);

            var keyboard = new KeyboardMarkup(KeyboardTools.GetConfirmAndCancelButtons(CommandName));

            await SendMessageAsync(Message);
            await SendMessageAsync(IsItCorrectMessage, keyboardMarkup : keyboard);
        }
Ejemplo n.º 15
0
 private void keyboard_hook_KeyDown(object sender, KeyEventArgs e)
 {
     if (Keys.Z == e.KeyCode && KeyboardTools.IsWinDown())
     {
         Logging.Info("Qiqqa is being activated by WIN-Z");
         MainWindowServiceDispatcher.Instance.OpenPopupInCite();
         Activate();
         e.Handled = true;
     }
 }
        void ObjSeries_MouseClick(object sender, ChartMouseEventArgs e)
        {
            FeatureTrackingManager.Instance.UseFeature(Features.Library_GenericExplorer_ChartItem);

            ChartSegment chart_segment = e.Segment;
            IList        data_source   = (IList)chart_segment.Series.DataSource;
            ChartItem    chart_item    = (ChartItem)data_source[chart_segment.CorrespondingPoints[0].Index];

            ToggleSelectItem(chart_item.Caption, KeyboardTools.IsCTRLDown() || KeyboardTools.IsShiftDown());
        }
        public override async Task MainAction(BotUpdate update, IBotClient client)
        {
            var keyboard = new KeyboardMarkup(new KeyboardButtonInfo[][]
            {
                KeyboardTools.GetProductsButtonRow(SelectedCategoryName, CommandName),
                new KeyboardButtonInfo[] { KeyboardTools.GetBackButton(CommandName) }
            });

            NextStep = new DescribeProductStep(ChatId, client, SelectedCategoryName);

            await EditMessageAsync(string.Format(Message, SelectedCategoryName), update.CallbackMessageId, keyboard);
        }
        void TreeSearchTerms_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                List <string> items = new List <string>();
                foreach (GenericLibraryExplorerItem item in TreeSearchTerms.SelectedItems)
                {
                    items.Add(item.tag);
                }

                ToggleSelectItems(items, KeyboardTools.IsCTRLDown() || KeyboardTools.IsShiftDown());
            }
        }
Ejemplo n.º 19
0
        private void LibraryControl_KeyDown(object sender, KeyEventArgs e)
        {
            if (Key.F == e.Key && KeyboardTools.IsCTRLDown())
            {
                ObjLibraryFilterControl_Search.SearchQuick.FocusSearchArea();
                e.Handled = true;
            }
            else if (Key.F5 == e.Key && KeyboardTools.IsNoneOfTheMetaKeysDown())
            {
                ObjLibraryCatalogControl.ListPDFDocuments.UpdateLayout();

                e.Handled = true;
            }
        }
 private void QuickAddTagsWindow_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         DoClose();
         e.Handled = true;
     }
     else if (e.Key == Key.Enter && KeyboardTools.IsCTRLDown())
     {
         AddTagsFromTextBox();
         DoClose();
         e.Handled = true;
     }
 }
        private void text_block_word_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (null != TagClick)
            {
                FeatureTrackingManager.Instance.UseFeature(Features.Document_TagCloud);

                // If they are not holding down CTRL, clear down the already selected items
                if (!KeyboardTools.IsCTRLDown())
                {
                    foreach (var tag in entries)
                    {
                        tag.selected = false;
                    }

                    foreach (TextBlock text_block_word in TagPanel.Children)
                    {
                        text_block_word.FontWeight = FontWeights.Normal;
                    }
                }

                {
                    // Find the clicked tag
                    TextBlock     text_block_word = (TextBlock)sender;
                    TagCloudEntry entry           = (TagCloudEntry)text_block_word.Tag;
                    entry.selected             = !entry.selected;
                    text_block_word.FontWeight = entry.selected ? FontWeights.Bold : FontWeights.Normal;
                }

                // Get all the selected tags
                List <string> tags_selected = new List <string>();
                {
                    if (null != entries)
                    {
                        foreach (var tag in entries)
                        {
                            if (tag.selected)
                            {
                                tags_selected.Add(tag.word);
                            }
                        }
                    }
                }

                TagClick(tags_selected);
            }
        }
Ejemplo n.º 22
0
        private void ButtonLaunchWord_Click(object sender, RoutedEventArgs e)
        {
            if (Runtime.IsRunningInVisualStudioDesigner)
            {
                return;
            }

            // Check if the user wants to override their version of Word.
            if (KeyboardTools.IsCTRLDown())
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Filter          = "Microsoft Word|winword.exe" + "|" + "Executable files|*.exe" + "|" + "All files|*.*";
                dialog.CheckFileExists = true;
                dialog.Multiselect     = false;
                if (true == dialog.ShowDialog())
                {
                    ConfigurationManager.Instance.ConfigurationRecord.InCite_WinWordLocation = dialog.FileName;
                    ConfigurationManager.Instance.ConfigurationRecord_Bindable.NotifyPropertyChanged(nameof(ConfigurationManager.Instance.ConfigurationRecord.InCite_WinWordLocation));
                }
                else
                {
                    ConfigurationManager.Instance.ConfigurationRecord.InCite_WinWordLocation = "";
                    ConfigurationManager.Instance.ConfigurationRecord_Bindable.NotifyPropertyChanged(nameof(ConfigurationManager.Instance.ConfigurationRecord.InCite_WinWordLocation));
                }
            }

            string app_to_launch = ConfigurationManager.Instance.ConfigurationRecord.InCite_WinWordLocation;

            if (String.IsNullOrEmpty(app_to_launch))
            {
                app_to_launch = "winword.exe";
            }

            try
            {
                Process.Start(app_to_launch);
            }
            catch (Exception ex)
            {
                Logging.Warn(ex, "Problem starting {0}", app_to_launch);
                MessageBoxes.Error("There has been a problem starting Word from the location '{0}'.  This is probably because Word is not in your PATH.  Please try again while holding down the CTRL button so that you can select Word manually.  You are looking for winword.exe.", app_to_launch);
            }
        }
        public void RequestSync(SyncRequest sync_request)
        {
            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            GlobalSyncDetail       global_sync_detail = GenerateGlobalSyncDetail();
            SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail);

            scgis.AutoTick();

            if (scgis.CanRunWithoutIntervention() && !user_wants_intervention)
            {
                Sync(scgis);
            }
            else
            {
                SyncControl sync_control = new SyncControl();
                sync_control.SetSyncParameters(scgis);
                sync_control.Show();
            }
        }
        private void PDFTextLayer_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.C && KeyboardTools.IsCTRLDown())
            {
                Logging.Info("Copying text");

                FeatureTrackingManager.Instance.UseFeature(Features.Document_CopyText);

                try
                {
                    string selected_text = text_selection_manager.GetLastSelectedWordsString();
                    ClipboardTools.SetText(selected_text);
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "There was a problem copying text to the clipboard.");
                }

                e.Handled = true;
            }
        }
Ejemplo n.º 25
0
        public void RequestSync(SyncRequest sync_request)
        {
            WPFDoEvents.AssertThisCodeIsRunningInTheUIThread();

            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                //
                // Explicitly instruct the sync info collector to perform a swift scan, which DOES NOT include
                // collecting the precise size of every document in every Qiqqa library (which itself is a *significant*
                // file system load when you have any reasonably large libraries like I do.          [GHo]
                //
                // TODO: fetch and cache document filesizes in the background, so we can improve on the accuracy
                // of our numbers in a future call to this method.
                //
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail(tally_library_storage_size: false);
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail);
                    scgis.AutoTick();

                    if (scgis.CanRunWithoutIntervention() && !user_wants_intervention)
                    {
                        Sync(scgis);
                    }
                    else
                    {
                        SyncControl sync_control = new SyncControl();
                        sync_control.SetSyncParameters(scgis);
                        sync_control.Show();
                    }
                });
            });
        }
Ejemplo n.º 26
0
        private void MainWindow_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (!KeyboardTools.IsCTRLDown())
            {
                switch (e.Key)
                {
                case Key.F1:
                    if (KeyboardTools.IsShiftDown())
                    {
                        MainWindowServiceDispatcher.Instance.OpenControlPanel();
                    }
                    else
                    {
                        MainWindowServiceDispatcher.Instance.OpenStartPage();
                    }
                    e.Handled = true;
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 27
0
        internal void PDFRendererControl_KeyUp(object sender, KeyEventArgs e)
        {
            if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
            {
                switch (e.Key)
                {
                case Key.P:
                    if (ZoomType.Zoom1Up == zoom_type)
                    {
                        PageZoom(ZoomType.Zoom2Up);
                    }
                    else
                    {
                        PageZoom(ZoomType.Zoom1Up);
                    }

                    e.Handled = true;
                    break;

                case Key.M:
                    ReconsiderOperationMode(OperationMode.Hand);
                    e.Handled = true;

                    break;

                case Key.A:
                    ReconsiderOperationMode(OperationMode.Annotation);
                    e.Handled = true;
                    break;

                case Key.H:
                    ReconsiderOperationMode(OperationMode.Highlighter);
                    e.Handled = true;
                    break;

                case Key.S:
                    ReconsiderOperationMode(OperationMode.TextSentenceSelect);
                    e.Handled = true;
                    break;

                case Key.I:
                    ReconsiderOperationMode(OperationMode.Ink);
                    e.Handled = true;
                    break;

                case Key.R:
                    ReconsiderOperationMode(OperationMode.Camera);
                    e.Handled = true;
                    break;

                case Key.B:
                    GoogleBibTexSnifferControl sniffer = new GoogleBibTexSnifferControl();
                    sniffer.Show(pdf_renderer_control_stats.pdf_document);
                    e.Handled = true;
                    break;

                case Key.Add:
                case Key.OemPlus:
                    IncrementalZoom(+1);
                    e.Handled = true;
                    break;

                case Key.Subtract:
                case Key.OemMinus:
                    IncrementalZoom(-1);
                    e.Handled = true;
                    break;

                default:
                    if (Key.D1 <= e.Key && Key.D9 >= e.Key)
                    {
                        if (KeyboardTools.IsShiftDown())
                        {
                            int bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                            BookmarkManager.SetDocumentBookmark(pdf_renderer_control_stats.pdf_document, bookmark_number, ScrollPages.VerticalOffset / ScrollPages.ScrollableHeight);
                            StatusManager.Instance.UpdateStatus("Bookmarks", "Set bookmark " + bookmark_number);

                            e.Handled = true;
                        }

                        else
                        {
                            int    bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                            double vertical_offset = BookmarkManager.GetDocumentBookmark(pdf_renderer_control_stats.pdf_document, bookmark_number);
                            ScrollPages.ScrollToVerticalOffset(vertical_offset * ScrollPages.ScrollableHeight);
                            StatusManager.Instance.UpdateStatus("Bookmarks", "Jumped to bookmark " + bookmark_number);

                            e.Handled = true;
                        }
                    }
                    break;
                }
            }
        }
        internal void PDFRendererControl_KeyUp(object sender, KeyEventArgs e)
        {
            if (false)
            {
            }

            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.P)
            {
                if (ZoomType.Zoom1Up == zoom_type)
                {
                    PageZoom(ZoomType.Zoom2Up);
                }
                else
                {
                    PageZoom(ZoomType.Zoom1Up);
                }

                e.Handled = true;
            }

            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.M)
            {
                ReconsiderOperationMode(OperationMode.Hand);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.A)
            {
                ReconsiderOperationMode(OperationMode.Annotation);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.H)
            {
                ReconsiderOperationMode(OperationMode.Highlighter);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.S)
            {
                ReconsiderOperationMode(OperationMode.TextSentenceSelect);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.I)
            {
                ReconsiderOperationMode(OperationMode.Ink);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.R)
            {
                ReconsiderOperationMode(OperationMode.Camera);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.B)
            {
                GoogleBibTexSnifferControl sniffer = new GoogleBibTexSnifferControl();
                sniffer.Show(this.pdf_renderer_control_stats.pdf_document);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.Add || KeyboardTools.IsCTRLDown() && e.Key == Key.OemPlus)
            {
                IncrementalZoom(+1);
                e.Handled = true;
            }
            else if (KeyboardTools.IsCTRLDown() && e.Key == Key.Subtract || KeyboardTools.IsCTRLDown() && e.Key == Key.OemMinus)
            {
                IncrementalZoom(-1);
                e.Handled = true;
            }

            else if (Key.D1 <= e.Key && Key.D9 >= e.Key)
            {
                if (KeyboardTools.IsCTRLDown() && KeyboardTools.IsShiftDown())
                {
                    int bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                    BookmarkManager.SetDocumentBookmark(this.pdf_renderer_control_stats.pdf_document, bookmark_number, ScrollPages.VerticalOffset / ScrollPages.ScrollableHeight);
                    StatusManager.Instance.UpdateStatus("Bookmarks", "Set bookmark " + bookmark_number);

                    e.Handled = true;
                }

                else if (KeyboardTools.IsCTRLDown())
                {
                    int    bookmark_number = BookmarkManager.KeyToBookmarkNumber(e.Key);
                    double vertical_offset = BookmarkManager.GetDocumentBookmark(this.pdf_renderer_control_stats.pdf_document, bookmark_number);
                    ScrollPages.ScrollToVerticalOffset(vertical_offset * ScrollPages.ScrollableHeight);
                    StatusManager.Instance.UpdateStatus("Bookmarks", "Jumped to bookmark " + bookmark_number);

                    e.Handled = true;
                }
            }
        }