示例#1
0
        public void SetUpFiltersMenu()
        {
            SFilters.Items.Clear();

            Fluent.MenuItem cfd = new Fluent.MenuItem();
            cfd.Header = cfs;
            cfd.Click += new RoutedEventHandler(cfd_Click);
            SFilters.Items.Add(cfd);

            SFilters.Items.Add(new Separator());

            if (useesc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = esc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usessc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = ssc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (useasc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = asc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usedsc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = dsc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usemsc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = msc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (useusc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = usc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
        }
示例#2
0
        public void SetUpFiltersMenu()
        {
            SFilters.Items.Clear();

            Fluent.MenuItem cfd = new Fluent.MenuItem();
            cfd.Header = "Clear All Filters";
            cfd.Click += new RoutedEventHandler(cfd_Click);
            SFilters.Items.Add(cfd);

            SFilters.Items.Add(new Separator());


            ////Aaron Campf
            //useasc = true;
            //usedsc = true;
            //useesc = true;
            //usemsc = true;
            //usessc = true;
            //useusc = true;
            ////Aaron Campf

            Action <string> AddMenuItem = (Header) => {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = Header;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            };

            if (useesc)
            {
                AddMenuItem(esc);
            }
            if (usessc)
            {
                AddMenuItem(ssc);
            }
            if (useasc)
            {
                AddMenuItem(asc);
            }
            if (usedsc)
            {
                AddMenuItem(dsc);
            }
            if (usemsc)
            {
                AddMenuItem(msc);
            }
            if (useusc)
            {
                AddMenuItem(usc);
            }
        }
示例#3
0
		public static Fluent.MenuItem Build_MenuItem(Object header = null, Object tag = null, Object icon = null, string name = null, object ToolTip = null,
			bool focusable = true, bool checkable = false, bool isChecked = false, string GroupName = null, System.Windows.RoutedEventHandler onClick = null) {

			var Item = new Fluent.MenuItem() {
				Name = name,
				Header = header,
				Tag = tag,
				Focusable = focusable,
				IsCheckable = checkable,
				IsChecked = isChecked,
				Icon = icon,
				GroupName = GroupName,
				ToolTip = ToolTip
			};

			if (onClick != null) Item.Click += onClick;
			return Item;
		} //TODO: Convert this into an extension
示例#4
0
        public static Fluent.MenuItem Build_MenuItem(Object header  = null, Object tag     = null, Object icon     = null, string name = null, object ToolTip = null,
                                                     bool focusable = true, bool checkable = false, bool isChecked = false, string GroupName = null, System.Windows.RoutedEventHandler onClick = null)
        {
            var Item = new Fluent.MenuItem()
            {
                Name        = name,
                Header      = header,
                Tag         = tag,
                Focusable   = focusable,
                IsCheckable = checkable,
                IsChecked   = isChecked,
                Icon        = icon,
                GroupName   = GroupName,
                ToolTip     = ToolTip
            };

            if (onClick != null)
            {
                Item.Click += onClick;
            }
            return(Item);
        } //TODO: Convert this into an extension
        public void SetUpFiltersMenu()
        {
            SFilters.Items.Clear();

            Fluent.MenuItem cfd = new Fluent.MenuItem();
            cfd.Header = cfs;
            cfd.Click += new RoutedEventHandler(cfd_Click);
            SFilters.Items.Add(cfd);
            
            SFilters.Items.Add(new Separator());

            if (useesc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = esc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usessc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = ssc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (useasc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = asc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usedsc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = dsc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (usemsc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = msc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
            if (useusc == true)
            {
                Fluent.MenuItem a = new Fluent.MenuItem();
                a.Header = usc;
                a.Click += new RoutedEventHandler(a_Click);
                SFilters.Items.Add(a);
            }
        }
示例#6
0
        /// <summary>
        /// Constructs the copy/move to menu for tabs
        /// </summary>
        private void ConstructMoveToCopyToMenu()
        {
            this.btnMoveto.Items.Clear();
            this.btnCopyto.Items.Clear();

            var sod = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Desktop).Pidl);
            var bmpSourceDesktop = sod.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

            var otherLocationMove = Utilities.Build_MenuItem(this.FindResource("miOtherDestCP"), onClick: new RoutedEventHandler(this.btnmtOther_Click));
            var otherLocationCopy = Utilities.Build_MenuItem(this.FindResource("miOtherDestCP"), onClick: new RoutedEventHandler(this.btnctOther_Click));
            var mimDesktop        = Utilities.Build_MenuItem(this.FindResource("btnctDesktopCP"), icon: bmpSourceDesktop, onClick: new RoutedEventHandler(this.btnmtDesktop_Click));
            var micDesktop        = Utilities.Build_MenuItem(this.FindResource("btnctDesktopCP"), icon: bmpSourceDesktop, onClick: new RoutedEventHandler(this.btnctDesktop_Click));

            MenuItem mimDocuments = new MenuItem(), micDocuments = new MenuItem();

            try {
                var sodc = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Documents).Pidl);
                var bmpSourceDocuments = sodc.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

                mimDocuments = Utilities.Build_MenuItem(this.FindResource("btnctDocumentsCP"), icon: bmpSourceDocuments, onClick: new RoutedEventHandler(this.btnmtDocuments_Click));
                micDocuments = Utilities.Build_MenuItem(this.FindResource("btnctDocumentsCP"), icon: bmpSourceDocuments, onClick: new RoutedEventHandler(this.btnctDocuments_Click));
            }
            catch (Exception) {
                mimDocuments = null;
                micDocuments = null;

                // catch the exception in case the user deleted that basic folder somehow
            }

            MenuItem mimDownloads = new MenuItem(), micDownloads = new MenuItem();

            try {
                var sodd = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Downloads).Pidl);
                var bmpSourceDownloads = sodd.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

                mimDownloads = Utilities.Build_MenuItem(this.FindResource("btnctDownloadsCP"), icon: bmpSourceDownloads, onClick: new RoutedEventHandler(this.btnmtDounloads_Click));
                micDownloads = Utilities.Build_MenuItem(this.FindResource("btnctDownloadsCP"), icon: bmpSourceDownloads, onClick: new RoutedEventHandler(this.btnctDounloads_Click));
            }
            catch (Exception) {
                micDownloads = null;
                mimDownloads = null;

                // catch the exception in case the user deleted that basic folder somehow
            }

            if (mimDocuments != null)
            {
                this.btnMoveto.Items.Add(mimDocuments);
            }

            if (mimDownloads != null)
            {
                this.btnMoveto.Items.Add(mimDownloads);
            }

            this.btnMoveto.Items.Add(mimDesktop);
            this.btnMoveto.Items.Add(new Separator());

            if (micDocuments != null)
            {
                this.btnCopyto.Items.Add(micDocuments);
            }

            if (micDownloads != null)
            {
                this.btnCopyto.Items.Add(micDownloads);
            }

            this.btnCopyto.Items.Add(micDesktop);
            this.btnCopyto.Items.Add(new Separator());

            foreach (var item in this.tcMain.Items.OfType <Wpf.Controls.TabItem>())
            {
                var isAdditem = true;
                item.ShellObject = item.ShellObject.Clone();
                foreach (var mii in this.btnCopyto.Items.OfType <MenuItem>().Where(x => x.Tag != null))
                {
                    if ((mii.Tag as IListItemEx).Equals(item.ShellObject))
                    {
                        isAdditem = false;
                    }
                }

                if (isAdditem && item.ShellObject.IsFileSystem)
                {
                    try {
                        var so        = item.ShellObject;
                        var bmpSource = so.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);
                        this.btnMoveto.Items.Add(Utilities.Build_MenuItem(item.ShellObject.DisplayName, item.ShellObject, bmpSource, onClick: new RoutedEventHandler(this.mim_Click)));
                        this.btnCopyto.Items.Add(Utilities.Build_MenuItem(item.ShellObject.DisplayName, item.ShellObject, bmpSource, onClick: new RoutedEventHandler(this.mico_Click)));
                    }
                    catch {
                        // Do nothing if ShellItem is not available anymore and close the problematic item
                        // tcMain.RemoveTabItem(item);
                    }
                }
            }

            this.btnMoveto.Items.Add(new Separator());
            this.btnMoveto.Items.Add(otherLocationMove);
            this.btnCopyto.Items.Add(new Separator());
            this.btnCopyto.Items.Add(otherLocationCopy);
        }
示例#7
0
        public void MakeRibbon()
        {
            PlugInManager pm = new PlugInManager();

            foreach (IExplorerRibbonTab exRibbonTab in OrderedPluginList<IExplorerRibbonTab>.Sort(pm.GetPluginNodes(Plugins.Type.IExplorerRibbonTab)))
            {
                Fluent.RibbonTabItem tabItem = new Fluent.RibbonTabItem();
                tabItem.Header = exRibbonTab.Header;
                ribbon.Tabs.Add(tabItem);
                tabItem.DataContext = exRibbonTab;

                foreach (RibbonGroupBox exGroupBox in exRibbonTab.Groups)
                {
                    Fluent.RibbonGroupBox groupBox = new Fluent.RibbonGroupBox();
                    groupBox.Header = exGroupBox.Header;
                    tabItem.Groups.Add(groupBox);

                    foreach (RibbonItem cartoRibbonItem in exGroupBox.Items)
                    {
                        Guid toolGUID = cartoRibbonItem.Guid;
                        if (toolGUID == new Guid("00000000-0000-0000-0000-000000000000"))
                        {
                            groupBox.Items.Add(new Separator());
                            continue;
                        }

                        object tool = pm.CreateInstance(toolGUID);
                        if (tool == null) continue;

                        #region IToolItem
                        if (tool is IToolItem)
                        {
                            if (((IToolItem)tool).ToolItem != null)
                            {
                                if (((IToolItem)tool).ToolItem is System.Windows.Forms.ToolStripItem)
                                {
                                    StackPanel panel = new StackPanel();
                                    panel.Margin = new Thickness(0, 32, 0, 0);

                                    System.Windows.Forms.ToolStripItem stripItem = (System.Windows.Forms.ToolStripItem)((IToolItem)tool).ToolItem;

                                    System.Windows.Forms.MenuStrip bar = new System.Windows.Forms.MenuStrip();
                                    bar.BackColor = System.Drawing.Color.Transparent; //.FromArgb(223, 234, 246);

                                    bar.Items.Add(stripItem);

                                    WindowsFormsHost host = new WindowsFormsHost();
                                    host.Background = new SolidColorBrush(Color.FromRgb(223, 234, 246));
                                    host.Child = bar;

                                    if (tool is IToolItemLabel)
                                    {
                                        IToolItemLabel label = (IToolItemLabel)tool;
                                        panel.Orientation = label.LabelPosition == ToolItemLabelPosition.top ||
                                                            label.LabelPosition == ToolItemLabelPosition.bottom ? Orientation.Vertical : Orientation.Horizontal;

                                        if (panel.Orientation == Orientation.Vertical)
                                            panel.Margin = new Thickness(0, 13, 0, 0);
                                        TextBlock text = new TextBlock();
                                        text.Text = label.Label;
                                        text.Padding = new Thickness(3);

                                        if (label.LabelPosition == ToolItemLabelPosition.top || label.LabelPosition == ToolItemLabelPosition.left)
                                            panel.Children.Insert(0, text);
                                        else
                                            panel.Children.Add(text);
                                    }

                                    panel.Children.Add(host);

                                    groupBox.Items.Add(panel);
                                }
                            }
                        }
                        #endregion

                        #region IToolMenu
                        else if (tool is IExToolMenu)
                        {
                            DropDownToolButton button = new DropDownToolButton(tool as IExToolMenu);
                            button.Click += new RoutedEventHandler(ToolButton_Click);
                            groupBox.Items.Add(button);
                        }
                        #endregion

                        #region ITool
                        else if (tool is IExTool)
                        {
                            ((IExTool)tool).OnCreate(_application);
                            ToolButton button = new ToolButton(tool as IExTool);
                            button.SizeDefinition = cartoRibbonItem.SizeDefinition;

                            groupBox.Items.Add(button);
                            button.Click += new RoutedEventHandler(ToolButton_Click);
                            
                        }
                        #endregion
                    }
                }

                if (ribbon.Tabs.Count == 1)
                {
                    #region Favorites
                    Fluent.RibbonGroupBox favBox = new Fluent.RibbonGroupBox();
                    favBox.Header = String.Empty;
                    _favDropDownButton = new Fluent.DropDownButton();
                    _favDropDownButton.Header = "Favorites";
                    _favDropDownButton.Icon = _favDropDownButton.LargeIcon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart);

                    Fluent.MenuItem add2fav = new Fluent.MenuItem();
                    add2fav.Header = "Add to favorites...";
                    add2fav.Icon = ImageFactory.FromBitmap(global::gView.Desktop.Wpf.DataExplorer.Properties.Resources.folder_heart);
                    add2fav.Click += new RoutedEventHandler(Add2Favorites_Click);
                    _favDropDownButton.Items.Add(add2fav);

                    bool first = true;
                    foreach (MyFavorites.Favorite fav in (new MyFavorites().Favorites))
                    {
                        if (fav == null) continue;
                        WpfFavoriteMenuItem fItem = new WpfFavoriteMenuItem(fav);
                        fItem.Click += new RoutedEventHandler(MenuItem_Favorite_Click);

                        if (first)
                        {
                            first = false;
                            _favDropDownButton.Items.Add(new Separator());
                        }
                        _favDropDownButton.Items.Add(fItem);
                    }

                    favBox.Items.Add(_favDropDownButton);
                    ribbon.Tabs[0].Groups.Add(favBox);
                    #endregion

                    _createNewRibbonGroupBox = new Fluent.RibbonGroupBox();
                    _createNewRibbonGroupBox.Header = "Create New";
                    _createNewRibbonGroupBox.Visibility = Visibility.Visible;
                    _createNewRibbonGroupBox.Background = new SolidColorBrush(Colors.GreenYellow);
                    
                    ribbon.Tabs[0].Groups.Add(_createNewRibbonGroupBox);
                }
            }

            #region Options
            Fluent.RibbonTabItem optionsTab = new Fluent.RibbonTabItem() { Header = "Options" };
            Fluent.RibbonGroupBox optionsBox = new Fluent.RibbonGroupBox() { Header = String.Empty };
            optionsTab.Groups.Add(optionsBox);

            foreach (XmlNode pageNode in pm.GetPluginNodes(Plugins.Type.IExplorerOptionPage))
            {
                IExplorerOptionPage page = pm.CreateInstance(pageNode) as IExplorerOptionPage;
                if (page == null) continue;

                OptionsButton button = new OptionsButton(page);
                button.Click += new RoutedEventHandler(OptoinButton_Click);
                optionsBox.Items.Add(button);
            }
            ribbon.Tabs.Add(optionsTab);
            #endregion
        }
示例#8
0
		public void SetUpFiltersMenu() {
			SFilters.Items.Clear();

			Fluent.MenuItem cfd = new Fluent.MenuItem();
			cfd.Header = "Clear All Filters";
			cfd.Click += new RoutedEventHandler(cfd_Click);
			SFilters.Items.Add(cfd);

			SFilters.Items.Add(new Separator());


			////Aaron Campf
			//useasc = true;
			//usedsc = true;
			//useesc = true;
			//usemsc = true;
			//usessc = true;
			//useusc = true;
			////Aaron Campf

			Action<string> AddMenuItem = (Header) => {
				Fluent.MenuItem a = new Fluent.MenuItem();
				a.Header = Header;
				a.Click += new RoutedEventHandler(a_Click);
				SFilters.Items.Add(a);
			};

			if (useesc) AddMenuItem(esc);
			if (usessc) AddMenuItem(ssc);
			if (useasc) AddMenuItem(asc);
			if (usedsc) AddMenuItem(dsc);
			if (usemsc) AddMenuItem(msc);
			if (useusc) AddMenuItem(usc);
		}
		private void ConstructMoveToCopyToMenu() {
			btnMoveto.Items.Clear();
			btnCopyto.Items.Clear();

			var sod = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Desktop).Pidl);
			var bmpSourceDesktop = sod.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

			var OtherLocationMove = Utilities.Build_MenuItem(FindResource("miOtherDestCP"), onClick: new RoutedEventHandler(btnmtOther_Click));
			var OtherLocationCopy = Utilities.Build_MenuItem(FindResource("miOtherDestCP"), onClick: new RoutedEventHandler(btnctOther_Click));
			var mimDesktop = Utilities.Build_MenuItem(FindResource("btnctDesktopCP"), icon: bmpSourceDesktop, onClick: new RoutedEventHandler(btnmtDesktop_Click));
			var micDesktop = Utilities.Build_MenuItem(FindResource("btnctDesktopCP"), icon: bmpSourceDesktop, onClick: new RoutedEventHandler(btnctDesktop_Click));

			MenuItem mimDocuments = new MenuItem(), micDocuments = new MenuItem();
			try {
				var sodc = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Documents).Pidl);
				var bmpSourceDocuments = sodc.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

				mimDocuments = Utilities.Build_MenuItem(FindResource("btnctDocumentsCP"), icon: bmpSourceDocuments, onClick: new RoutedEventHandler(btnmtDocuments_Click));
				micDocuments = Utilities.Build_MenuItem(FindResource("btnctDocumentsCP"), icon: bmpSourceDocuments, onClick: new RoutedEventHandler(btnctDocuments_Click));
			}
			catch (Exception) {
				mimDocuments = null;
				micDocuments = null;
				//catch the exception in case the user deleted that basic folder somehow
			}

			MenuItem mimDownloads = new MenuItem(), micDownloads = new MenuItem();
			try {
				var sodd = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, ((ShellItem)KnownFolders.Downloads).Pidl);
				var bmpSourceDownloads = sodd.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);

				mimDownloads = Utilities.Build_MenuItem(FindResource("btnctDownloadsCP"), icon: bmpSourceDownloads, onClick: new RoutedEventHandler(btnmtDounloads_Click));
				micDownloads = Utilities.Build_MenuItem(FindResource("btnctDownloadsCP"), icon: bmpSourceDownloads, onClick: new RoutedEventHandler(btnctDounloads_Click));
			}
			catch (Exception) {
				micDownloads = null;
				mimDownloads = null;
				//catch the exception in case the user deleted that basic folder somehow
			}

			if (mimDocuments != null)
				btnMoveto.Items.Add(mimDocuments);
			if (mimDownloads != null)
				btnMoveto.Items.Add(mimDownloads);

			btnMoveto.Items.Add(mimDesktop);
			btnMoveto.Items.Add(new Separator());

			if (micDocuments != null)
				btnCopyto.Items.Add(micDocuments);
			if (micDownloads != null)
				btnCopyto.Items.Add(micDownloads);

			btnCopyto.Items.Add(micDesktop);
			btnCopyto.Items.Add(new Separator());

			foreach (var item in tcMain.Items.OfType<Wpf.Controls.TabItem>()) {
				bool IsAdditem = true;
				item.ShellObject = item.ShellObject.Clone();
				foreach (var mii in btnCopyto.Items.OfType<MenuItem>().Where(x => x.Tag != null)) {
					if ((mii.Tag as IListItemEx).Equals(item.ShellObject)) {
						IsAdditem = false;
					}
				}

				if (IsAdditem && item.ShellObject.IsFileSystem) {
					try {
						var so = item.ShellObject;
						var bmpSource = so.ThumbnailSource(16, ShellThumbnailFormatOption.IconOnly, ShellThumbnailRetrievalOption.Default);
						btnMoveto.Items.Add(Utilities.Build_MenuItem(item.ShellObject.DisplayName, item.ShellObject,
																												 bmpSource, onClick: new RoutedEventHandler(mim_Click)));

						btnCopyto.Items.Add(Utilities.Build_MenuItem(item.ShellObject.DisplayName, item.ShellObject, bmpSource, onClick: new RoutedEventHandler(mico_Click)));
					}
					catch {
						//Do nothing if ShellItem is not available anymore and close the problematic item
						//tcMain.RemoveTabItem(item);
					}
				}
			}

			btnMoveto.Items.Add(new Separator());
			btnMoveto.Items.Add(OtherLocationMove);
			btnCopyto.Items.Add(new Separator());
			btnCopyto.Items.Add(OtherLocationCopy);
		}