Inheritance: System.Windows.Controls.MenuItem, ISyncKeyTipAndContent
        private static RibbonMenuItem GenerateAddToOrRemoveFromQATItem(bool controlIsInQAT, RibbonContextMenu contextMenu)
        {
            RibbonMenuItem addToOrRemoveFromQATItem = new RibbonMenuItem() { CanAddToQuickAccessToolBarDirectly = false };

            if (controlIsInQAT)
            {
                addToOrRemoveFromQATItem.Header = RemoveFromQATText;
                addToOrRemoveFromQATItem.Command = RibbonCommands.RemoveFromQuickAccessToolBarCommand;
            }
            else
            {
                addToOrRemoveFromQATItem.Header = AddToQATText;
                addToOrRemoveFromQATItem.Command = RibbonCommands.AddToQuickAccessToolBarCommand;
            }

            Binding placementTargetBinding = new Binding("PlacementTarget") { Source = contextMenu };
            addToOrRemoveFromQATItem.SetBinding(RibbonMenuItem.CommandTargetProperty, placementTargetBinding);

            return addToOrRemoveFromQATItem;
        }
Exemple #2
0
        public static void OnApplicationMenuItemUpDownKeyDown(KeyEventArgs e, RibbonMenuItem menuItem)
        {
            if (e.Handled || menuItem.IsSubmenuOpen)
            {
                return;
            }

            if (e.Key == Key.Up ||
                e.Key == Key.Down)
            {
                RibbonApplicationMenu applicationMenu = ItemsControl.ItemsControlFromItemContainer(menuItem) as RibbonApplicationMenu;
                if (applicationMenu != null)
                {
                    if (RibbonHelper.IsEndFocusableMenuItem(menuItem, e.Key == Key.Up /* isFirst */))
                    {
                        if (e.Key == Key.Down)
                        {
                            // If the focus is at the last focusable item,
                            // then try moving the focus to first element of
                            // auxiliary pane and then to first element of footer
                            // pane if needed.
                            if (applicationMenu.AuxiliaryPaneMoveFocus(FocusNavigationDirection.First) ||
                                applicationMenu.FooterPaneMoveFocus(FocusNavigationDirection.First))
                            {
                                e.Handled = true;
                            }
                        }
                        else
                        {
                            // If the focus is at the first focusable item,
                            // then try moving the focus to last element of
                            // footer pane and then to last element of auxiliary
                            // pane if needed.
                            if (applicationMenu.FooterPaneMoveFocus(FocusNavigationDirection.Last) ||
                                applicationMenu.AuxiliaryPaneMoveFocus(FocusNavigationDirection.Last))
                            {
                                e.Handled = true;
                            }
                        }
                    }
                }
            }
        }
        private static RibbonMenuItem GenerateAddGalleryToQATItem(RibbonContextMenu contextMenu)
        {
            RibbonMenuItem addGalleryToQATItem = new RibbonMenuItem();

            addGalleryToQATItem.Header = _addGalleryToQATText;

            // Even for galleries in QAT, this menu item always binds the "add to QAT" command.
            addGalleryToQATItem.Command = RibbonCommands.AddToQuickAccessToolBarCommand;

            Binding placementTargetBinding = new Binding("PlacementTarget") { Source = contextMenu };
            addGalleryToQATItem.SetBinding(RibbonMenuItem.CommandTargetProperty, placementTargetBinding);

            return addGalleryToQATItem;
        }
Exemple #4
0
 internal static void UnhookPopupForTopLevelMenuItem(RibbonMenuItem menuItem)
 {
     Popup popup = menuItem.Popup;
     if (popup != null)
     {
         popup.ClearValue(Popup.PlacementTargetProperty);
         popup.ClearValue(Popup.WidthProperty);
         popup.ClearValue(Popup.HeightProperty);
         menuItem.CoerceValue(RibbonMenuItem.DropDownHeightProperty);
     }
 }
Exemple #5
0
        /// <summary>
        ///     Helper method to determine if the given menu item
        ///     is the first / last focusable item of its parent.
        /// </summary>
        private static bool IsEndFocusableMenuItem(RibbonMenuItem menuItem, bool isFirst)
        {
            ItemsControl parentItemsControl = ItemsControl.ItemsControlFromItemContainer(menuItem);
            Debug.Assert(parentItemsControl != null);

            int parentItemCount = parentItemsControl.Items.Count;
            int itemIndex = parentItemsControl.ItemContainerGenerator.IndexFromContainer(menuItem);

            int incr = 1;
            if (isFirst)
            {
                incr = -1;
            }

            for (int i = itemIndex + incr; i < parentItemCount && i >= 0; i += incr)
            {
                UIElement container = parentItemsControl.ItemContainerGenerator.ContainerFromIndex(i) as UIElement;
                if (container != null &&
                    container.IsVisible &&
                    container.IsEnabled &&
                    container.Focusable)
                {
                    return false;
                }
            }
            return true;
        }
Exemple #6
0
        private void RibbonWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.Wait;
                Logger.Log("START Application");

                //upgrade nastaveni pro novou verzi
                if (Settings.Default.UpgradeSettings)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpgradeSettings = false;
                    Settings.Default.Save();
                }

                //nastrojova lista + menu
                this.FileAuxiliaryPaneTitle.Text = (Institution != null ? Institution.Name : "Instituce není nastavena");
                this.FileAuxiliaryPaneContent.Text = (SelectedCatalogue != null ? SelectedCatalogue.Name : "Katalog není vybrán") + Environment.NewLine;
                this.FileAuxiliaryPaneContent.Text += (!String.IsNullOrEmpty(Settings.Default.ScannerSourceName) ? Settings.Default.ScannerSourceName : "Skener není vybrán") + Environment.NewLine;

                //nastaveni katalogu
                foreach (var catalogue in Institution.Catalogues)
                {
                    RibbonMenuItem item = new RibbonMenuItem();
                    item.Style = (LayoutRoot.Resources["RibbonMenuItemCheckable"] as Style);
                    item.IsChecked = (catalogue.CatalogueID == Settings.Default.SelectedCatalogueID);
                    item.Header = catalogue.Name;
                    item.Tag = catalogue.CatalogueID;
                    item.Click += CatalogueMenuItem_Click;
                    this.CatalogueButton.Items.Add(item);
                }

                SetScannerPageSize(Settings.Default.ScannerPageSize);
                SetScannerPageOrientation(Settings.Default.ScannerPageOrientation);

                //kontrola nastaveni
                if (!String.IsNullOrEmpty(Settings.Default.ScanFolderPath))
                {
                    if (!Directory.Exists(Settings.Default.ScanFolderPath))
                        Directory.CreateDirectory(Settings.Default.ScanFolderPath);
                }
                else
                {
                    string message = "Není nastavena složka pro ukládání naskenovaných souborů.";
                    MessageBox.Show(message, this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    Logger.Log(String.Format("WARNING: {0}", message));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error);
                Logger.Log(String.Format("ERROR: {0}", ex.Message));
            }
            finally
            {
                SetMenuButtonsEnabled();
                GetAvailableMemory(false);
                this.Cursor = null;
            }
        }
Exemple #7
0
        internal static void HookPopupForTopLevelMenuItem(RibbonMenuItem menuItem, ItemsControl parentItemsControl)
        {
            Popup popup = menuItem.Popup;
            if (popup != null)
            {
                Binding binding = new Binding("SubmenuPlaceholder");
                binding.Source = parentItemsControl;
                BindingOperations.SetBinding(popup, Popup.PlacementTargetProperty, binding);

                binding = new Binding("SubmenuPlaceholder.ActualWidth");
                binding.Source = parentItemsControl;
                BindingOperations.SetBinding(popup, Popup.WidthProperty, binding);

                binding = new Binding("SubmenuPlaceholder.ActualHeight");
                binding.Source = parentItemsControl;
                BindingOperations.SetBinding(popup, Popup.HeightProperty, binding);
                BindingOperations.SetBinding(menuItem, RibbonMenuItem.DropDownHeightProperty, binding);
            }
        }
Exemple #8
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.RibbonWindow = ((Client.MainWindow)(target));
     
     #line 10 "..\..\MainWindow.xaml"
     this.RibbonWindow.Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);
     
     #line default
     #line hidden
     return;
     case 2:
     this.Ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target));
     return;
     case 3:
     this._Connect = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 20 "..\..\MainWindow.xaml"
     this._Connect.Click += new System.Windows.RoutedEventHandler(this._Connect_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this._Disconnect = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 26 "..\..\MainWindow.xaml"
     this._Disconnect.Click += new System.Windows.RoutedEventHandler(this._Disconnect_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this._Exit = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 32 "..\..\MainWindow.xaml"
     this._Exit.Click += new System.Windows.RoutedEventHandler(this._Exit_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.FileTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 7:
     this.NewDirectory = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 47 "..\..\MainWindow.xaml"
     this.NewDirectory.Click += new System.Windows.RoutedEventHandler(this.NewDirectory_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.Rename = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 54 "..\..\MainWindow.xaml"
     this.Rename.Click += new System.Windows.RoutedEventHandler(this.Rename_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.Move = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 61 "..\..\MainWindow.xaml"
     this.Move.Click += new System.Windows.RoutedEventHandler(this.Move_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.Delete = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 68 "..\..\MainWindow.xaml"
     this.Delete.Click += new System.Windows.RoutedEventHandler(this.Delete_Click);
     
     #line default
     #line hidden
     return;
     case 11:
     this.Upload = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 80 "..\..\MainWindow.xaml"
     this.Upload.Click += new System.Windows.RoutedEventHandler(this.Upload_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     this.Download = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 87 "..\..\MainWindow.xaml"
     this.Download.Click += new System.Windows.RoutedEventHandler(this.Download_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     this._Rename = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 94 "..\..\MainWindow.xaml"
     this._Rename.Click += new System.Windows.RoutedEventHandler(this.Rename_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.Copy = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 100 "..\..\MainWindow.xaml"
     this.Copy.Click += new System.Windows.RoutedEventHandler(this.Copy_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.Paste = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 106 "..\..\MainWindow.xaml"
     this.Paste.Click += new System.Windows.RoutedEventHandler(this.Paste_Click);
     
     #line default
     #line hidden
     return;
     case 16:
     this.Details = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 112 "..\..\MainWindow.xaml"
     this.Details.Click += new System.Windows.RoutedEventHandler(this.Details_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this._Delete = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 118 "..\..\MainWindow.xaml"
     this._Delete.Click += new System.Windows.RoutedEventHandler(this.Delete_Click);
     
     #line default
     #line hidden
     return;
     case 18:
     this._AddUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 130 "..\..\MainWindow.xaml"
     this._AddUser.Click += new System.Windows.RoutedEventHandler(this._AddUser_Click);
     
     #line default
     #line hidden
     return;
     case 19:
     this._EditUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 137 "..\..\MainWindow.xaml"
     this._EditUser.Click += new System.Windows.RoutedEventHandler(this._EditUser_Click);
     
     #line default
     #line hidden
     return;
     case 20:
     this._ViewUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 143 "..\..\MainWindow.xaml"
     this._ViewUser.Click += new System.Windows.RoutedEventHandler(this._ViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this._AddGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 152 "..\..\MainWindow.xaml"
     this._AddGroup.Click += new System.Windows.RoutedEventHandler(this._AddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 22:
     this._EditGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 158 "..\..\MainWindow.xaml"
     this._EditGroup.Click += new System.Windows.RoutedEventHandler(this._EditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 23:
     this._ViewGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 164 "..\..\MainWindow.xaml"
     this._ViewGroup.Click += new System.Windows.RoutedEventHandler(this._ViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 24:
     this.TaskTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 25:
     this.AccessTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 26:
     this.AddUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 183 "..\..\MainWindow.xaml"
     this.AddUser.Click += new System.Windows.RoutedEventHandler(this.AddUser_Click);
     
     #line default
     #line hidden
     return;
     case 27:
     this.EditUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 189 "..\..\MainWindow.xaml"
     this.EditUser.Click += new System.Windows.RoutedEventHandler(this.EditUser_Click);
     
     #line default
     #line hidden
     return;
     case 28:
     this.ViewUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 195 "..\..\MainWindow.xaml"
     this.ViewUser.Click += new System.Windows.RoutedEventHandler(this.ViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 29:
     this.AddGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 204 "..\..\MainWindow.xaml"
     this.AddGroup.Click += new System.Windows.RoutedEventHandler(this.AddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 30:
     this.EditGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 210 "..\..\MainWindow.xaml"
     this.EditGroup.Click += new System.Windows.RoutedEventHandler(this.EditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 31:
     this.ViewGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 216 "..\..\MainWindow.xaml"
     this.ViewGroup.Click += new System.Windows.RoutedEventHandler(this.ViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 32:
     this.HelpTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 33:
     this.AboutTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 34:
     this.dockPanel = ((System.Windows.Controls.DockPanel)(target));
     return;
     case 35:
     this.listBox = ((System.Windows.Controls.ListBox)(target));
     return;
     }
     this._contentLoaded = true;
 }
Exemple #9
0
        // Once the filterMenuButton is loaded, its template is available and we can find the ContentPresenter that
        // hosts the current filter.  We must bind our FilterItemTemplateSelector so that the current filter, hosted in a RibbonToggleButton,
        // displays the same way as the filters themselves, which are RibbonMenuItems.
        private void filterMenuButton_Loaded(object sender, RoutedEventArgs e)
        {
            _filterMenuButton.Loaded -= new RoutedEventHandler(filterMenuButton_Loaded);

            RibbonToggleButton filterToggleButton = _filterMenuButton.Template.FindName(RibbonMenuButton.ToggleButtonTemplatePartName, _filterMenuButton) as RibbonToggleButton;
            if (filterToggleButton != null)
            {
                Binding currentFilterBinding = new Binding("CurrentFilter") { Source = this };
                filterToggleButton.SetBinding(RibbonToggleButton.ContentProperty, currentFilterBinding);

                // Find the RibbonMenuItem for the filter itself so that we can template it.
                // We need to set the following bindings on it:
                //  - DataContext --> CurrentFilter
                //  - Style --> CurrentFilterStyle
                //  - Header --> CurrentFilterHeader  (plus some extra handling for when CurrentFilterHeader is of type BindingBase; see its coercion)
                //  - Template --> CurrentFilterTemplate
                _currentFilterItem = filterToggleButton.Template.FindName("CurrentFilterItem", filterToggleButton) as RibbonMenuItem;
                if (_currentFilterItem != null)
                {
                    // DataContext --> CurrentFilter
                    _currentFilterItem.SetBinding(RibbonMenuItem.DataContextProperty, currentFilterBinding);

                    // Style --> CurrentFilterStyle
                    Binding currentFilterStyleBinding = new Binding("CurrentFilterStyle") { Source = this };
                    _currentFilterItem.SetBinding(RibbonMenuItem.StyleProperty, currentFilterStyleBinding);

                    // Header --> CurrentFilterHeader
                    this.SetHeaderBindingForCurrentFilterItem();

                    // Template --> CurrentFilterTemplate
                    this.SetTemplateBindingForCurrentFilterItem();
                }
            }

            PropertyHelper.TransferProperty(this, ContextMenuProperty);   // Coerce to get a default ContextMenu if none has been specified.
            PropertyHelper.TransferProperty(this, RibbonControlService.CanAddToQuickAccessToolBarDirectlyProperty);
        }
 private void populateAltPaths()
 {
     AltSaveButton.Items.Clear();
     AltSaveButton.Items.Add(AddAltSaveFolder);
     foreach (AltPathHolder alt in Core.settings.save_paths) {
         RibbonMenuItem item = new RibbonMenuItem();
         item.Header = Strings.GetLabelString("RemoteAltSavePath", alt.path);
         item.ToolTip = alt.path;
         item.Click += new RoutedEventHandler(item_Click);
         AltSaveButton.Items.Add(item);
     }
 }
Exemple #11
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.RibbonWindow = ((Client.MainWindow)(target));
     
     #line 9 "..\..\MainWindow.xaml"
     this.RibbonWindow.Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);
     
     #line default
     #line hidden
     return;
     case 2:
     this.Ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target));
     
     #line 13 "..\..\MainWindow.xaml"
     this.Ribbon.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.Ribbon_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 3:
     this._Connect = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 19 "..\..\MainWindow.xaml"
     this._Connect.Click += new System.Windows.RoutedEventHandler(this._Connect_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this._Disconnect = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 25 "..\..\MainWindow.xaml"
     this._Disconnect.Click += new System.Windows.RoutedEventHandler(this._Disconnect_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this._Exit = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target));
     
     #line 31 "..\..\MainWindow.xaml"
     this._Exit.Click += new System.Windows.RoutedEventHandler(this._Exit_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.FileTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 7:
     this.NewDirectory = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 46 "..\..\MainWindow.xaml"
     this.NewDirectory.Click += new System.Windows.RoutedEventHandler(this.NewDirectory_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.Rename = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 53 "..\..\MainWindow.xaml"
     this.Rename.Click += new System.Windows.RoutedEventHandler(this.Rename_Click);
     
     #line default
     #line hidden
     return;
     case 9:
     this.Move = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 60 "..\..\MainWindow.xaml"
     this.Move.Click += new System.Windows.RoutedEventHandler(this.Move_Click);
     
     #line default
     #line hidden
     return;
     case 10:
     this.Delete = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 67 "..\..\MainWindow.xaml"
     this.Delete.Click += new System.Windows.RoutedEventHandler(this.Delete_Click);
     
     #line default
     #line hidden
     return;
     case 11:
     this.Upload = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 79 "..\..\MainWindow.xaml"
     this.Upload.Click += new System.Windows.RoutedEventHandler(this.Upload_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     this.Download = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 86 "..\..\MainWindow.xaml"
     this.Download.Click += new System.Windows.RoutedEventHandler(this.Download_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     this._Rename = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 93 "..\..\MainWindow.xaml"
     this._Rename.Click += new System.Windows.RoutedEventHandler(this.Rename_Click);
     
     #line default
     #line hidden
     return;
     case 14:
     this.Copy = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 99 "..\..\MainWindow.xaml"
     this.Copy.Click += new System.Windows.RoutedEventHandler(this.Copy_Click);
     
     #line default
     #line hidden
     return;
     case 15:
     this.Paste = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 105 "..\..\MainWindow.xaml"
     this.Paste.Click += new System.Windows.RoutedEventHandler(this.Paste_Click);
     
     #line default
     #line hidden
     return;
     case 16:
     this.Details = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 111 "..\..\MainWindow.xaml"
     this.Details.Click += new System.Windows.RoutedEventHandler(this.Details_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this._Delete = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 117 "..\..\MainWindow.xaml"
     this._Delete.Click += new System.Windows.RoutedEventHandler(this.Delete_Click);
     
     #line default
     #line hidden
     return;
     case 18:
     this._AddUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 129 "..\..\MainWindow.xaml"
     this._AddUser.Click += new System.Windows.RoutedEventHandler(this._AddUser_Click);
     
     #line default
     #line hidden
     return;
     case 19:
     this._EditUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 136 "..\..\MainWindow.xaml"
     this._EditUser.Click += new System.Windows.RoutedEventHandler(this._EditUser_Click);
     
     #line default
     #line hidden
     return;
     case 20:
     this._ViewUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 142 "..\..\MainWindow.xaml"
     this._ViewUser.Click += new System.Windows.RoutedEventHandler(this._ViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 21:
     this._AddGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 151 "..\..\MainWindow.xaml"
     this._AddGroup.Click += new System.Windows.RoutedEventHandler(this._AddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 22:
     this._EditGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 157 "..\..\MainWindow.xaml"
     this._EditGroup.Click += new System.Windows.RoutedEventHandler(this._EditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 23:
     this._ViewGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 163 "..\..\MainWindow.xaml"
     this._ViewGroup.Click += new System.Windows.RoutedEventHandler(this._ViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 24:
     this.TaskTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 25:
     this._TaskRefresh = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 176 "..\..\MainWindow.xaml"
     this._TaskRefresh.Click += new System.Windows.RoutedEventHandler(this._TaskRefresh_Click);
     
     #line default
     #line hidden
     return;
     case 26:
     this.AccessTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 27:
     this._AccessViewPermissions = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 189 "..\..\MainWindow.xaml"
     this._AccessViewPermissions.Click += new System.Windows.RoutedEventHandler(this._AccessViewPermissions_Click);
     
     #line default
     #line hidden
     return;
     case 28:
     this.AddUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 199 "..\..\MainWindow.xaml"
     this.AddUser.Click += new System.Windows.RoutedEventHandler(this.AddUser_Click);
     
     #line default
     #line hidden
     return;
     case 29:
     this.EditUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 205 "..\..\MainWindow.xaml"
     this.EditUser.Click += new System.Windows.RoutedEventHandler(this.EditUser_Click);
     
     #line default
     #line hidden
     return;
     case 30:
     this.ViewUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 211 "..\..\MainWindow.xaml"
     this.ViewUser.Click += new System.Windows.RoutedEventHandler(this.ViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 31:
     this.AddGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 220 "..\..\MainWindow.xaml"
     this.AddGroup.Click += new System.Windows.RoutedEventHandler(this.AddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 32:
     this.EditGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 226 "..\..\MainWindow.xaml"
     this.EditGroup.Click += new System.Windows.RoutedEventHandler(this.EditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 33:
     this.ViewGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 232 "..\..\MainWindow.xaml"
     this.ViewGroup.Click += new System.Windows.RoutedEventHandler(this.ViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 34:
     this.HelpTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 35:
     this._HelpFileNewDirectory = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 247 "..\..\MainWindow.xaml"
     this._HelpFileNewDirectory.Click += new System.Windows.RoutedEventHandler(this._HelpFileNewDirectory_Click);
     
     #line default
     #line hidden
     return;
     case 36:
     this._HelpFileRename = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 252 "..\..\MainWindow.xaml"
     this._HelpFileRename.Click += new System.Windows.RoutedEventHandler(this._HelpFileRename_Click);
     
     #line default
     #line hidden
     return;
     case 37:
     this._HelpFileMoveDirectory = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 257 "..\..\MainWindow.xaml"
     this._HelpFileMoveDirectory.Click += new System.Windows.RoutedEventHandler(this._HelpFileMoveDirectory_Click);
     
     #line default
     #line hidden
     return;
     case 38:
     this._HelpFileDeleteDirectory = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 262 "..\..\MainWindow.xaml"
     this._HelpFileDeleteDirectory.Click += new System.Windows.RoutedEventHandler(this._HelpFileDeleteDirectory_Click);
     
     #line default
     #line hidden
     return;
     case 39:
     this._HelpFileUploadFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 271 "..\..\MainWindow.xaml"
     this._HelpFileUploadFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileUploadFile_Click);
     
     #line default
     #line hidden
     return;
     case 40:
     this._HelpFileDownloadFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 276 "..\..\MainWindow.xaml"
     this._HelpFileDownloadFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileDownloadFile_Click);
     
     #line default
     #line hidden
     return;
     case 41:
     this._HelpFileRenameFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 281 "..\..\MainWindow.xaml"
     this._HelpFileRenameFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileRenameFile_Click);
     
     #line default
     #line hidden
     return;
     case 42:
     this._HelpFileCopyFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 286 "..\..\MainWindow.xaml"
     this._HelpFileCopyFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileCopyFile_Click);
     
     #line default
     #line hidden
     return;
     case 43:
     this._HelpFilePasteFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 291 "..\..\MainWindow.xaml"
     this._HelpFilePasteFile.Click += new System.Windows.RoutedEventHandler(this._HelpFilePasteFile_Click);
     
     #line default
     #line hidden
     return;
     case 44:
     this._HelpFileDetailsFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 296 "..\..\MainWindow.xaml"
     this._HelpFileDetailsFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileDetailsFile_Click);
     
     #line default
     #line hidden
     return;
     case 45:
     this._HelpFileDeleteFile = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 301 "..\..\MainWindow.xaml"
     this._HelpFileDeleteFile.Click += new System.Windows.RoutedEventHandler(this._HelpFileDeleteFile_Click);
     
     #line default
     #line hidden
     return;
     case 46:
     this._HelpFileAddUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 311 "..\..\MainWindow.xaml"
     this._HelpFileAddUser.Click += new System.Windows.RoutedEventHandler(this._HelpFileAddUser_Click);
     
     #line default
     #line hidden
     return;
     case 47:
     this._HelpFileEditUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 316 "..\..\MainWindow.xaml"
     this._HelpFileEditUser.Click += new System.Windows.RoutedEventHandler(this._HelpFileEditUser_Click);
     
     #line default
     #line hidden
     return;
     case 48:
     this._HelpFileViewUser = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 321 "..\..\MainWindow.xaml"
     this._HelpFileViewUser.Click += new System.Windows.RoutedEventHandler(this._HelpFileViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 49:
     this._HelpFileAddGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 330 "..\..\MainWindow.xaml"
     this._HelpFileAddGroup.Click += new System.Windows.RoutedEventHandler(this._HelpFileAddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 50:
     this._HelpFileEditGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 335 "..\..\MainWindow.xaml"
     this._HelpFileEditGroup.Click += new System.Windows.RoutedEventHandler(this._HelpFileEditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 51:
     this._HelpFileViewGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 340 "..\..\MainWindow.xaml"
     this._HelpFileViewGroup.Click += new System.Windows.RoutedEventHandler(this._HelpFileViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 52:
     this._HelpTaskRefresh = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 355 "..\..\MainWindow.xaml"
     this._HelpTaskRefresh.Click += new System.Windows.RoutedEventHandler(this._HelpTaskRefresh_Click);
     
     #line default
     #line hidden
     return;
     case 53:
     
     #line 368 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileAddUser_Click);
     
     #line default
     #line hidden
     return;
     case 54:
     
     #line 372 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileEditUser_Click);
     
     #line default
     #line hidden
     return;
     case 55:
     
     #line 376 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileViewUser_Click);
     
     #line default
     #line hidden
     return;
     case 56:
     
     #line 384 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileAddGroup_Click);
     
     #line default
     #line hidden
     return;
     case 57:
     
     #line 388 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileEditGroup_Click);
     
     #line default
     #line hidden
     return;
     case 58:
     
     #line 392 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this._HelpFileViewGroup_Click);
     
     #line default
     #line hidden
     return;
     case 59:
     this.AboutTab = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target));
     return;
     case 60:
     this._Authors = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 411 "..\..\MainWindow.xaml"
     this._Authors.Click += new System.Windows.RoutedEventHandler(this._Authors_Click);
     
     #line default
     #line hidden
     return;
     case 61:
     this._Version = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 416 "..\..\MainWindow.xaml"
     this._Version.Click += new System.Windows.RoutedEventHandler(this._Version_Click);
     
     #line default
     #line hidden
     return;
     case 62:
     this.dockPanel = ((System.Windows.Controls.DockPanel)(target));
     return;
     case 63:
     this.listBox = ((System.Windows.Controls.ListBox)(target));
     return;
     }
     this._contentLoaded = true;
 }
Exemple #12
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target));
     return;
     case 2:
     this.nowy_dok = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 14 "..\..\MainWindow.xaml"
     this.nowy_dok.Click += new System.Windows.RoutedEventHandler(this.nowy_dok_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     this.open_dok = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuItem)(target));
     
     #line 15 "..\..\MainWindow.xaml"
     this.open_dok.Click += new System.Windows.RoutedEventHandler(this.open_dok_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this.wklej = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 21 "..\..\MainWindow.xaml"
     this.wklej.Click += new System.Windows.RoutedEventHandler(this.wklej_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.czonkagroup = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target));
     return;
     case 6:
     this.fontcombo = ((Microsoft.Windows.Controls.Ribbon.RibbonComboBox)(target));
     return;
     case 7:
     this.upbutton = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target));
     
     #line 27 "..\..\MainWindow.xaml"
     this.upbutton.Click += new System.Windows.RoutedEventHandler(this.upbutton_Click);
     
     #line default
     #line hidden
     return;
     case 8:
     this.sizecombo = ((Microsoft.Windows.Controls.Ribbon.RibbonComboBox)(target));
     return;
     case 9:
     
     #line 29 "..\..\MainWindow.xaml"
     ((Microsoft.Windows.Controls.Ribbon.RibbonGallery)(target)).SelectionChanged += new System.Windows.RoutedPropertyChangedEventHandler<object>(this.RibbonGallery_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 10:
     this.richTextBox = ((System.Windows.Controls.RichTextBox)(target));
     
     #line 43 "..\..\MainWindow.xaml"
     this.richTextBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.richTextBox_TextChanged);
     
     #line default
     #line hidden
     return;
     case 11:
     this.comboBox = ((System.Windows.Controls.ComboBox)(target));
     
     #line 50 "..\..\MainWindow.xaml"
     this.comboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.comboBox_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 12:
     this.Text4 = ((System.Windows.Controls.ComboBoxItem)(target));
     return;
     case 13:
     this.asdasdasd = ((System.Windows.Controls.ComboBoxItem)(target));
     return;
     }
     this._contentLoaded = true;
 }
 /// <summary>
 ///   Initialize Automation Peer for RibbonMenuItem
 /// </summary>
 public RibbonMenuItemAutomationPeer(RibbonMenuItem owner)
     : base(owner)
 {
 }
Exemple #14
0
        public MainWindow()
        {
            InitializeComponent();
            InitializeShortcuts();

            try
            {
                Version version = Assembly.GetExecutingAssembly().GetName().Version;
                string appName = Properties.Resources.ApplicationName;
                string fullName = AuthController.UserIdentity.LoginUser.FullName;
                this.RibbonWindow.Title = String.Format("{0} v{1}.{2}.{3} [{4}]", appName, version.Major, version.Minor, version.Revision, fullName);
                this.WindowState = (Settings.Default.MainWindowMax ? WindowState.Maximized : WindowState.Normal);
                this.Topmost = Settings.Default.AppAlwaysOnTop;

                if (Settings.Default.AppLogging)
                {
                    Logger.Open();
                    Logger.Log(String.Format("\n{0}, Version:{1}.{2}.{3} Build:{4}, UserName:{5}, MachineName:{6}", appName, version.Major, version.Minor, version.Revision, version.Build, fullName, Environment.MachineName));
                }

                this.ScannerColorModeCoverCategory.ItemsSource = Enumeration.GetList(typeof(ColourSetting));
                this.ScannerColorModeContentsCategory.ItemsSource = Enumeration.GetList(typeof(ColourSetting));
                this.ScannerResolutionCoverCategory.ItemsSource = ScanImage.RESOLUTIONS;
                this.ScannerResolutionContentsCategory.ItemsSource = ScanImage.RESOLUTIONS;

                this.DataContext = this;

                Loaded += delegate
                {
                    try
                    {
                        _twain = new Twain(new WpfWindowMessageHook(this));
                        _twain.TransferImage += TwainTransferImage;
                        _twain.ScanningComplete += TwainScanningComplete;
                        foreach (var name in _twain.SourceNames)
                        {
                            RibbonMenuItem item = new RibbonMenuItem();
                            item.Style = (LayoutRoot.Resources["RibbonMenuItemCheckable"] as Style);
                            item.IsChecked = (name == Settings.Default.ScannerSourceName);
                            item.Header = name;
                            item.Click += ScannerMenuItem_Click;
                            this.ScannerButton.Items.Add(item);
                        }
                    }
                    catch (TwainException tex)
                    {
                        string message = tex.Message + "\n[Pravdepodobně není nainstalován ovladač pro skener]";
                        MessageBox.Show(message, "TWAIN", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        Logger.Log(String.Format("TWAIN: {0}", message));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error);
                        Logger.Log(String.Format("ERROR: {0}", ex.Message));
                    }
                };
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error);
                Logger.Log(String.Format("ERROR: {0}", ex.Message));
            }
        }
        private static RibbonMenuItem GenerateMinimizeTheRibbonItem(RibbonContextMenu contextMenu)
        {
            RibbonMenuItem minimizeTheRibbonItem = new RibbonMenuItem() { CanAddToQuickAccessToolBarDirectly = false };
            minimizeTheRibbonItem.Header = MinimizeTheRibbonText;

            PropertyPath path = new PropertyPath("(0).(1).(2)");
            path.PathParameters.Add(ContextMenuService.PlacementTargetProperty);
            path.PathParameters.Add(RibbonControlService.RibbonProperty);
            path.PathParameters.Add(Ribbon.IsMinimizedProperty);

            Binding isCheckedBinding = new Binding () { Source = contextMenu, Path = path };
            minimizeTheRibbonItem.SetBinding(RibbonMenuItem.IsCheckedProperty, isCheckedBinding);
            Binding isMinimizedBinding = new Binding() { Source = contextMenu, Path = path };
            isMinimizedBinding.Converter = new IsMinimizedToMinimizeOrMaximizeCommandConverter();
            minimizeTheRibbonItem.SetBinding(RibbonMenuItem.CommandProperty, isMinimizedBinding);
            Binding placementTargetBinding = new Binding("PlacementTarget") { Source = contextMenu };
            minimizeTheRibbonItem.SetBinding(RibbonMenuItem.CommandTargetProperty, placementTargetBinding);
            return minimizeTheRibbonItem;
        }
Exemple #16
0
        internal static bool CoerceIsSubmenuOpenForTopLevelItem(RibbonMenuItem menuItem, ItemsControl parentItemsControl, bool baseValue)
        {
            bool isSubMenuOpen = (bool)baseValue;
            if (!isSubMenuOpen && menuItem.CloseSubmenuTimer != null && menuItem.CloseSubmenuTimer.IsEnabled)
            {
                RibbonApplicationMenu ram = parentItemsControl as RibbonApplicationMenu;
                if (ram != null)
                {
                    RibbonMenuItem currentMenuItem = ram.CurrentSelection as RibbonMenuItem;
                    if (currentMenuItem != null && currentMenuItem.CanOpenSubMenu && currentMenuItem != menuItem)
                    {
                        return true;
                    }
                }
            }

            return baseValue;
        }
        private static RibbonMenuItem GenerateQATPlacementMenuItem(RibbonContextMenu contextMenu)
        {
            RibbonMenuItem qatPlacementItem = new RibbonMenuItem() { CanAddToQuickAccessToolBarDirectly = false };

            Binding headerBinding = new Binding("PlacementTarget") { Source = contextMenu };
            headerBinding.Converter = new PlacementTargetToQATPositionConverter(PlacementTargetToQATPositionConverter.ConverterMode.Header);
            qatPlacementItem.SetBinding(RibbonMenuItem.HeaderProperty, headerBinding);

            Binding commandBinding = new Binding("PlacementTarget") { Source = contextMenu };
            commandBinding.Converter = new PlacementTargetToQATPositionConverter(PlacementTargetToQATPositionConverter.ConverterMode.Command);
            qatPlacementItem.SetBinding(RibbonMenuItem.CommandProperty, commandBinding);

            Binding placementTargetBinding = new Binding("PlacementTarget") { Source = contextMenu };
            qatPlacementItem.SetBinding(RibbonMenuItem.CommandTargetProperty, placementTargetBinding);

            return qatPlacementItem;
        }
Exemple #18
0
        private void RibbonWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.Wait;
                Logger.Log("START Application");

                this.FrontCoverImgEdit.Tag = PartOfBook.FrontCover;
                this.FrontCoverImgEdit.EnableAsynchronousWork = false;
                this.FrontCoverImgScan.ImgEditComponent = this.FrontCoverImgEdit;
                this.FrontCoverThumbnails.ImgEditComponent = this.FrontCoverImgEdit;

                this.TableOfContentsImgEdit.Tag = PartOfBook.TableOfContents;
                this.TableOfContentsImgEdit.EnableAsynchronousWork = false;
                this.TableOfContentsImgScan.ImgEditComponent = this.TableOfContentsImgEdit;
                this.TableOfContentsThumbnails.ImgEditComponent = this.TableOfContentsImgEdit;

                //upgrade nastaveni pro novou verzi
                if (Settings.Default.UpgradeSettings)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpgradeSettings = false;
                    Settings.Default.Save();
                }

                //nastaveni katalogu
                if (Settings.Default.SelectedCatalogueID == 0 && Institution != null && Institution.Catalogues.Count > 0)
                {
                    Settings.Default.SelectedCatalogueID = Institution.Catalogues.First().CatalogueID;
                }

                //nastrojova lista + menu
                this.FileAuxiliaryPaneTitle.Text = (Institution != null ? Institution.Name : "Instituce není nastavena");
                this.FileAuxiliaryPaneContent.Text = (SelectedCatalogue != null ? SelectedCatalogue.Name : "Katalog není vybrán") + Environment.NewLine;
                this.FileAuxiliaryPaneContent.Text += (!String.IsNullOrEmpty(Settings.Default.ScannerSourceName) ? Settings.Default.ScannerSourceName : "Skener není vybrán") + Environment.NewLine;

                //nastaveni katalogu
                foreach (var catalogue in Institution.Catalogues)
                {
                    RibbonMenuItem item = new RibbonMenuItem();
                    item.Style = (LayoutRoot.Resources["RibbonMenuItemCheckable"] as Style);
                    item.IsChecked = (catalogue.CatalogueID == Settings.Default.SelectedCatalogueID);
                    item.Header = catalogue.Name;
                    item.Tag = catalogue.CatalogueID;
                    item.Click += CatalogueMenuItem_Click;
                    this.CatalogueButton.Items.Add(item);
                }

                //nastaveni skeneru
                ArrayList scanners = this.FrontCoverImgScan.GetScannerSources();
                foreach (string name in scanners)
                {
                    RibbonMenuItem item = new RibbonMenuItem();
                    bool active = FrontCoverImgScan.IsSourceActive(name);
                    item.Style = (LayoutRoot.Resources["RibbonMenuItemCheckable"] as Style);
                    item.IsChecked = (name.Equals(Settings.Default.ScannerSourceName));
                    item.Header = name;
                    item.Click += ScannerMenuItem_Click;
                    this.ScannerButton.Items.Add(item);
                }

                //nastveni barevneho modu
                if (String.IsNullOrEmpty(Settings.Default.ScanCoverPixelType))
                    Settings.Default.ScanCoverPixelType = TwainPixelTypes.RGB.ToDisplay();
                if (String.IsNullOrEmpty(Settings.Default.ScanContentsPixelType))
                    Settings.Default.ScanContentsPixelType = TwainPixelTypes.BW.ToDisplay();

                //nastveni velikosti a orientace
                SetScannerPageSize(Enumeration.Parse<ImgScan.ICTwainSupportedSizes>(Settings.Default.ScannerPageSize));
                SetScannerPageOrientation(Enumeration.Parse<ImgScan.ICTwainOrientations>(Settings.Default.ScanCapPaperOrientation));

                //nastaveni automaticke upravy
                SetScannerAutomatic();

                //logovani

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error);
                Logger.Log(String.Format("ERROR: {0}", ex.Message));
            }
            finally
            {
                SetMenuButtonsEnabled();
                GetAvailableMemory();
                this.Cursor = null;
            }
        }