示例#1
0
    void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
    {
        switch (connectionId)
        {
        case 1:
            this.DocBox = ((TabHeader)(target));
            return;

        case 2:
            this.Docker = ((System.Windows.Controls.DockPanel)(target));
            return;

        case 3:
            this.HeaderMenu = ((Fluent.ContextMenu)(target));
            return;

        case 4:
            this.SaveMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 5:
            this.SaveAsMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 6:
            this.SaveAllMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 7:
            this.CloseMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 8:
            this.CloseAllMenuItem = ((Fluent.MenuItem)(target));
            return;

        case 9:
            this.FileTypeImage = ((System.Windows.Controls.Image)(target));
            return;

        case 10:
            this.TabTitle = ((System.Windows.Controls.TextBlock)(target));
            return;

        case 11:
            this.TabToolTip = ((Fluent.ScreenTip)(target));
            return;

        case 12:
            this.CloseButton = ((Fluent.Button)(target));
            return;
        }
        this._contentLoaded = true;
    }
示例#2
0
        private void MenuItemWithRadioButtons_Click(object sender, RoutedEventArgs e)
        {
            Fluent.MenuItem oMenu     = (Fluent.MenuItem)sender;
            User            oUser     = (User)oMenu.DataContext;
            bool            bIsInList = UserListSelected.Contains(oUser);

            if (bIsInList)
            {
                UserListSelected.Remove(oUser);
            }
            else
            {
                UserListSelected.Add(oUser);
            }

            oMenu.IsChecked = !bIsInList;
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            ShellItem        con = this.ShellItem;
            List <ShellItem> joe = new List <ShellItem>();

            foreach (ShellItem item in con)
            {
                if (item.IsFolder)
                {
                    if (!item.ParsingName.EndsWith(".zip"))
                    {
                        joe.Add(item);
                    }
                }
            }

            joe.Sort(delegate(ShellItem j1, ShellItem j2) { return(j1.GetDisplayName(SIGDN.NORMALDISPLAY).CompareTo(j2.GetDisplayName(SIGDN.NORMALDISPLAY))); });
            DropDownMenu.Items.Clear();
            foreach (ShellItem thing in joe)
            {
                Fluent.MenuItem pan = new Fluent.MenuItem();
                thing.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                thing.Thumbnail.CurrentSize  = new System.Windows.Size(16, 16);
                pan.Icon = thing.Thumbnail.BitmapSource;
                var header        = thing.GetDisplayName(SIGDN.NORMALDISPLAY);
                var posunderscore = header.IndexOf("_");
                if (posunderscore != -1)
                {
                    header = header.Insert(posunderscore, "_");
                }
                pan.Header = header;
                pan.Height = 23;
                pan.Tag    = thing;

                pan.Click += new RoutedEventHandler(MenuItemClicked);
                this.DropDownMenu.Items.Add(pan);
            }
            if (DropDownMenu.Items.Count > 0)
            {
                DropDownMenu.Placement       = PlacementMode.Bottom;
                DropDownMenu.PlacementTarget = Base;
                DropDownMenu.IsOpen          = true;
            }
        }
示例#4
0
        private void AddApplicationMenuitems()
        {
            if (RibbonControl == null)
            {
                return;
            }

            AppData apData = _data as AppData;


            Grid menu = RibbonControl.Menu as Grid;

            var applicationMenu = menu.Children[0] as Fluent.ApplicationMenu;

            foreach (var item in applicationMenu.Items)
            {
                if (item is Fluent.MenuItem)
                {
                    var newdoc = item as Fluent.MenuItem;

                    if ("New" == (newdoc?.Header as string))
                    {
                        foreach (var docdata in apData.DocumentTypeData)
                        {
                            var newMenuItem = new Fluent.MenuItem();

                            newMenuItem.Header = docdata.TypeName;

                            var command = new NewDocumentButtonClick(docdata.DocType, _data);

                            newMenuItem.Command = command;

                            newMenuItem.Icon = docdata.IconPath;

                            newdoc.Items.Add(newMenuItem);
                        }
                    }
                }
            }
        }
        // Remove from group
        static void AddToGroup(string groupName, MenuItem button)
        {
            List<WeakReference> buttons = null;
            if (!groupedButtons.TryGetValue(groupName, out buttons))
            {
                buttons = new List<WeakReference>();
                groupedButtons.Add(groupName, buttons);
            }

            buttons.Add(new WeakReference(button));
        }
        void CreateTabbarRKMenu(CloseableTabItem tabitem)
        {
            tabitem.mnu = new ContextMenu();
            MenuItem miclosecurrentr = new MenuItem();
            miclosecurrentr.Header = "Close current tab";
            miclosecurrentr.Tag = tabitem;
            miclosecurrentr.Click += new RoutedEventHandler(miclosecurrentr_Click);
            tabitem.mnu.Items.Add(miclosecurrentr);

            MenuItem miclosealltab = new MenuItem();
            miclosealltab.Header = "Close all tabs";
            miclosealltab.Click += new RoutedEventHandler(miclosealltab_Click);
            tabitem.mnu.Items.Add(miclosealltab);

            MenuItem miclosealltabbd = new MenuItem();
            miclosealltabbd.Header = "Close all other tabs";
            miclosealltabbd.Tag = tabitem;
            miclosealltabbd.Click += new RoutedEventHandler(miclosealltabbd_Click);
            tabitem.mnu.Items.Add(miclosealltabbd);

            tabitem.mnu.Items.Add(new Separator());


            //tabitem.mnu.Items.Add(new Separator());

            MenuItem miopeninnew = new MenuItem();
            miopeninnew.Header = "Open in new window";
            miopeninnew.Tag = tabitem;
            miopeninnew.Click += new RoutedEventHandler(miopeninnew_Click);
            //tabitem.mnu.Items.Add(miopeninnew);

        }
        private void downArrow_Click(object sender, RoutedEventArgs e)
        {
            cmHistory.Items.Clear();
            cmHistory.Opened += new RoutedEventHandler(cmHistory_Opened);
            cmHistory.Closed += new RoutedEventHandler(cmHistory_Closed);

            NavigationLog nl = (tabControl1.Items[CurrentTabIndex] as CloseableTabItem).log;
            int i = 0;
            foreach (ShellObject item in nl.HistoryItemsList)
            {

                if (item != null)
                {
                    item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                    item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                    MenuItem mi = new MenuItem();
                    mi.Header = item.GetDisplayName(DisplayNameType.Default);
                    mi.Tag = item;
                    mi.Icon = item.Thumbnail.BitmapSource;
                    mi.IsCheckable = true;
                    mi.IsChecked = (i == nl.CurrentLocPos);
                    mi.GroupName = "G1";
                    mi.Click += new RoutedEventHandler(miItems_Click);
                    cmHistory.Items.Add(mi);
                }
                i++;
            }

            cmHistory.Placement = PlacementMode.Bottom;
            cmHistory.PlacementTarget = navBarGrid;
            cmHistory.IsOpen = true;
        }
 void fsw_Created(object sender, FileSystemEventArgs e)
 {
     Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                      (Action)(() =>
                      {
                          if (Path.GetExtension(e.FullPath).ToLowerInvariant() == ".lnk")
                          {
                              ShellObject so = ShellObject.FromParsingName(e.FullPath);
                              MenuItem mi = new MenuItem();
                              mi.Header = so.GetDisplayName(DisplayNameType.Default);
                              ShellLink lnk = new ShellLink(so.ParsingName);
                              mi.Tag = lnk.Target;
                              lnk.Dispose();
                              so.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                              so.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                              ImageSource icon = so.Thumbnail.BitmapSource;
                              mi.Icon = icon;
                              mi.Click += new RoutedEventHandler(mif_Click);
                              so.Dispose();
                              btnFavorites.Items.Add(mi);
                          }
                      }));
     WindowsAPI.SetFocus(ExplorerBrowser.SysListViewHandle);
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            bool exitApp = false;
            try
            {
                if (WindowsAPI.getOSInfo() == WindowsAPI.OsVersionInfo.Windows8)
                {
                    TheStatusBar.Visibility = System.Windows.Visibility.Collapsed;
                    rStatusbar.Height = new GridLength(0);
                }



                Handle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
                //Itmpop = new ItemPopup();
                //Itmpop.Visibility = System.Windows.Visibility.Hidden;
                //Itmpop.Owner = this;
                //Itmpop.Show();

                //'sets up FileSystemWatcher for Favorites folder
                String FavPath = "";
                try
                {
                    FavPath = KnownFolders.Links.ParsingName;
                    FileSystemWatcher fsw = new FileSystemWatcher(FavPath);
                    fsw.Created += new FileSystemEventHandler(fsw_Created);
                    fsw.Deleted += new FileSystemEventHandler(fsw_Deleted);
                    fsw.Renamed += new RenamedEventHandler(fsw_Renamed);
                    fsw.EnableRaisingEvents = true;
                }
                catch
                {

                    FavPath = "";
                }

                //' set up breadcrumb bar
                breadcrumbBarControl1.SetDragHandlers(new DragEventHandler(bbi_DragEnter), new DragEventHandler(bbi_DragLeave), new DragEventHandler(bbi_DragOver), new DragEventHandler(bbi_Drop));

                Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                 (ThreadStart)(() =>
                                 {
                                     //PicturePreview = new PreviewMedia();

                                     //'set up Favorites menu (note that BetterExplorer does not support links to a Control Panel. lol -JaykeBird)
                                     //'I will probably use a modification to this code in the new breadcrumbbar
                                     if (FavPath != "")
                                     {
                                         DirectoryInfo FavInfo = new DirectoryInfo(FavPath);
                                         FileInfo[] FavFiles = FavInfo.GetFiles();
                                         foreach (FileInfo item in FavFiles)
                                         {
                                             if (Path.GetExtension(item.FullName).ToLowerInvariant() == ".lnk")
                                             {
                                                 try
                                                 {
                                                     ShellObject so = ShellObject.FromParsingName(item.FullName);
                                                     MenuItem mi = new MenuItem();
                                                     mi.Header = so.GetDisplayName(DisplayNameType.Default);
                                                     ShellLink lnk = new ShellLink(so.ParsingName);
                                                     string Target = lnk.Target;
                                                     if (Target.Contains("::"))
                                                     {
                                                         Target = "shell:" + Target;
                                                     }
                                                     if (item.Name.ToLowerInvariant() == "recentplaces.lnk")
                                                     {
                                                         Target = "shell:::{22877a6d-37a1-461a-91b0-dbda5aaebc99}";
                                                     }
                                                     mi.Tag = Target;
                                                     lnk.Dispose();
                                                     so.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                                     so.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                                     ImageSource icon = so.Thumbnail.BitmapSource;
                                                     mi.Focusable = false;
                                                     mi.Icon = icon;
                                                     mi.Click += new RoutedEventHandler(mif_Click);
                                                     so.Dispose();
                                                     btnFavorites.Items.Add(mi);
                                                 }
                                                 catch
                                                 {


                                                 }
                                             }
                                         }
                                     }
                                     else
                                     {
                                         btnFavorites.Visibility = System.Windows.Visibility.Collapsed;
                                     }

                                     //'set up Explorer control
                                     Explorer.SelectionChanged += new EventHandler(ExplorerBrowserControl_SelectionChanged);
                                     Explorer.NavigationComplete += new EventHandler<NavigationCompleteEventArgs>(ExplorerBrowserControl_NavigationComplete);
                                     Explorer.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete);
                                     Explorer.NavigationPending += new EventHandler<NavigationPendingEventArgs>(Explorer_NavigationPending);
                                     Explorer.GotFocus += new EventHandler(Explorer_GotFocus);
                                     Explorer.ExplorerGotFocus += new EventHandler(Explorer_ExplorerGotFocus);
                                     //Explorer.ExplorerGotFocus += new EventHandler(Explorer_ExplorerGotFocus);
                                     Explorer.RenameFinished += new EventHandler(Explorer_RenameFinished);
                                     Explorer.KeyUP += new EventHandler<ExplorerKeyUPEventArgs>(Explorer_KeyUP);
                                     Explorer.KeyUp += new System.Windows.Forms.KeyEventHandler(explorerBrowser1_KeyUp);
                                     Explorer.LostFocus += new EventHandler(Explorer_LostFocus);

                                     Explorer.NavigationOptions.PaneVisibility.Commands = PaneVisibilityState.Hide;
                                     Explorer.NavigationOptions.PaneVisibility.CommandsOrganize = PaneVisibilityState.Hide;
                                     Explorer.NavigationOptions.PaneVisibility.CommandsView = PaneVisibilityState.Hide;
                                     Explorer.ItemsChanged += new EventHandler(Explorer_ItemsChanged);
                                     Explorer.ContentOptions.FullRowSelect = true;
                                     //Explorer.ContentOptions.CheckSelect = false;
                                     Explorer.ClientSizeChanged += new EventHandler(ExplorerBrowserControl_ClientSizeChanged);
                                     Explorer.Paint += new System.Windows.Forms.PaintEventHandler(ExplorerBrowserControl_Paint);
                                     Explorer.ViewChanged += new EventHandler<ViewChangedEventArgs>(Explorer_ViewChanged);
                                     //Explorer.ItemHot += new EventHandler<ExplorerAUItemEventArgs>(Explorer_ItemHot);
                                     Explorer.ExplorerBrowserMouseLeave += new EventHandler(Explorer_ExplorerBrowserMouseLeave);
                                     Explorer.MouseMove += new System.Windows.Forms.MouseEventHandler(Explorer_MouseMove);
                                     IsCalledFromLoading = true;
                                     WindowsAPI.SHELLSTATE state = new WindowsAPI.SHELLSTATE();
                                     WindowsAPI.SHGetSetSettings(ref state, WindowsAPI.SSF.SSF_SHOWALLOBJECTS | WindowsAPI.SSF.SSF_SHOWEXTENSIONS, false);
                                     chkHiddenFiles.IsChecked = (state.fShowAllObjects == 1);
                                     chkExtensions.IsChecked = (state.fShowExtensions == 1);
                                     IsCalledFromLoading = false;
                                     isOnLoad = true;
                                     //'load from Registry
                                     RegistryKey rk = Registry.CurrentUser;
                                     RegistryKey rks = rk.CreateSubKey(@"Software\BExplorer");

                                     switch (Convert.ToString(rks.GetValue(@"CurrentTheme", "Blue")))
                                     {
                                         case "Blue":
                                             btnBlue.IsChecked = true;
                                             break;
                                         case "Silver":
                                             btnSilver.IsChecked = true;
                                             break;
                                         case "Black":
                                             btnBlack.IsChecked = true;
                                             break;
                                         case "Green":
                                             btnGreen.IsChecked = true;
                                             break;
                                         default:
                                             btnBlue.IsChecked = true;
                                             break;
                                     }
                                     int HFlyoutEnabled = (int)rks.GetValue(@"HFlyoutEnabled", 0);

                                     IsHFlyoutEnabled = (HFlyoutEnabled == 1);
                                     chkIsFlyout.IsChecked = IsHFlyoutEnabled;

                                     int InfoPaneEnabled = (int)rks.GetValue(@"InfoPaneEnabled", 0);

                                     IsInfoPaneEnabled = (InfoPaneEnabled == 1);
                                     btnInfoPane.IsChecked = IsInfoPaneEnabled;

                                     int PreviewPaneEnabled = (int)rks.GetValue(@"PreviewPaneEnabled", 0);

                                     IsPreviewPaneEnabled = (PreviewPaneEnabled == 1);
                                     btnPreviewPane.IsChecked = IsPreviewPaneEnabled;

                                     int NavigationPaneEnabled = (int)rks.GetValue(@"NavigationPaneEnabled", 1);

                                     IsNavigationPaneEnabled = (NavigationPaneEnabled == 1);
                                     btnNavigationPane.IsChecked = IsNavigationPaneEnabled;

                                     int CheckBoxesEnabled = (int)rks.GetValue(@"CheckModeEnabled", 0);

                                     isCheckModeEnabled = (CheckBoxesEnabled == 1);
                                     chkShowCheckBoxes.IsChecked = isCheckModeEnabled;

                                     int ExFileOpEnabled = (int)rks.GetValue(@"FileOpExEnabled", 0);

                                     IsExtendedFileOpEnabled = (ExFileOpEnabled == 1);
                                     Explorer.IsExFileOpEnabled = IsExtendedFileOpEnabled;
                                     chkIsTerraCopyEnabled.IsChecked = IsExtendedFileOpEnabled;

                                     int CompartibleRename = (int)rks.GetValue(@"CompartibleRename", 1);

                                     IsCompartibleRename = (CompartibleRename == 1);

                                     //chkIsCompartibleRename.IsChecked = IsCompartibleRename;

                                     int RestoreTabs = (int)rks.GetValue(@"IsRestoreTabs", 1);

                                     IsrestoreTabs = (RestoreTabs == 1);

                                     chkIsRestoreTabs.IsChecked = IsrestoreTabs;

                                     int LogActions = (int)rks.GetValue(@"EnableActionLog", 0);

                                     canlogactions = (LogActions == 1);
                                     chkLogHistory.IsChecked = canlogactions;

                                     // load settings for auto-switch to contextual tab
                                     asFolder = ((int)rks.GetValue(@"AutoSwitchFolderTools", 0) == 1);
                                     asArchive = ((int)rks.GetValue(@"AutoSwitchArchiveTools", 1) == 1);
                                     asImage = ((int)rks.GetValue(@"AutoSwitchImageTools", 1) == 1);
                                     asApplication = ((int)rks.GetValue(@"AutoSwitchApplicationTools", 0) == 1);
                                     asLibrary = ((int)rks.GetValue(@"AutoSwitchLibraryTools", 1) == 1);
                                     asDrive = ((int)rks.GetValue(@"AutoSwitchDriveTools", 0) == 1);

                                     chkFolder.IsChecked = asFolder;
                                     chkArchive.IsChecked = asArchive;
                                     chkImage.IsChecked = asImage;
                                     chkApp.IsChecked = asApplication;
                                     chkLibrary.IsChecked = asLibrary;
                                     chkDrive.IsChecked = asDrive;

                                     // load OverwriteOnImages setting (default is false)
                                     int oor = (int)rks.GetValue(@"OverwriteImageWhileEditing", 0);
                                     OverwriteOnRotate = (oor == 1);
                                     chkOverwriteImages.IsChecked = (oor == 1);

                                     // set up history on breadcrumb bar (currently missing try-catch statement in order to catch error)
                                     try
                                     {
                                         breadcrumbBarControl1.ClearHistory();
                                         breadcrumbBarControl1.HistoryItems = ReadHistoryFromFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\history.txt");
                                     }
                                     catch (FileNotFoundException)
                                     {
                                       logger.Warn(String.Format("History file not found at location:{0}\\history.txt", Environment.SpecialFolder.LocalApplicationData));
                                     }

                                     AddToLog("Session Began");

                                     StartUpLocation =
                                          rks.GetValue(@"StartUpLoc", KnownFolders.Libraries.ParsingName).ToString();

                                     if (StartUpLocation == "")
                                     {
                                         rks.SetValue(@"StartUpLoc", KnownFolders.Libraries.ParsingName);
                                         StartUpLocation = KnownFolders.Libraries.ParsingName;
                                     }
                                     char[] delimiters = new char[] { ';' };
                                     string LastOpenedTabs = rks.GetValue(@"OpenedTabs", "").ToString();
                                     string[] Tabs = LastOpenedTabs.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

                                     rks.Close();
                                     rk.Close();

                                     try
                                     {
                                         RegistryKey rkbe = Registry.ClassesRoot;
                                         RegistryKey rksbe = rkbe.OpenSubKey(@"Folder\shell", RegistryKeyPermissionCheck.ReadSubTree);
                                         bool IsThereDefault = rksbe.GetValue("", "-1").ToString() != "";
                                         chkIsDefault.IsChecked = IsThereDefault;
                                         chkIsDefault.IsEnabled = true;
                                         rksbe.Close();
                                         rkbe.Close();
                                     }
                                     catch (Exception)
                                     {
                                         chkIsDefault.IsChecked = false;
                                         chkIsDefault.IsEnabled = false;
                                     }

                                     RegistryKey rkfe = Registry.CurrentUser;
                                     RegistryKey rksfe = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", RegistryKeyPermissionCheck.ReadSubTree);
                                     chkTreeExpand.IsChecked = (int)rksfe.GetValue("NavPaneExpandToCurrentFolder", 0) == 1;
                                     rksfe.Close();
                                     rkfe.Close();

                                     isOnLoad = false;


                                     //'Rest of the setup of Explorer control. We have to set up that here after 
                                     //the initialization of registry settings
                                     Explorer.NavigationOptions.PaneVisibility.Preview =
                                         IsPreviewPaneEnabled ? PaneVisibilityState.Show : PaneVisibilityState.Hide;
                                     Explorer.NavigationOptions.PaneVisibility.Details =
                                         IsInfoPaneEnabled ? PaneVisibilityState.Show : PaneVisibilityState.Hide;

                                     Explorer.NavigationOptions.PaneVisibility.Navigation =
                                         IsNavigationPaneEnabled ? PaneVisibilityState.Show : PaneVisibilityState.Hide;



                                     Explorer.ContentOptions.CheckSelect = isCheckModeEnabled;

                                     if (StartUpLocation.IndexOf("::") == 0 && StartUpLocation.IndexOf(@"\") == -1)
                                     {
                                         btnSetCurrentasStartup.Header =
                                            ShellObject.FromParsingName("Shell:" + StartUpLocation).GetDisplayName(DisplayNameType.Default);
                                         btnSetCurrentasStartup.Icon = ShellObject.FromParsingName("Shell:" + StartUpLocation).Thumbnail.BitmapSource;
                                     }
                                     else
                                     {
                                         try
                                         {
                                             btnSetCurrentasStartup.Header =
                                                  ShellObject.FromParsingName(StartUpLocation).GetDisplayName(DisplayNameType.Default);

                                             btnSetCurrentasStartup.Icon = ShellObject.FromParsingName(StartUpLocation).Thumbnail.BitmapSource;
                                         }
                                         catch 
                                         {
                                             
                                            
                                         }
                                     }

                                     //'set StartUp location
                                     if (Application.Current.Properties["cmd"] != null)
                                     {

                                         String cmd = Application.Current.Properties["cmd"].ToString();

                                         if (cmd.IndexOf("::") == 0)
                                         {

                                             Explorer.Navigate(ShellObject.FromParsingName("shell:" + cmd));
                                         }
                                         else
                                             Explorer.Navigate(ShellObject.FromParsingName(cmd.Replace("\"", "")));

                                         
                                         CloseableTabItem cti = new CloseableTabItem();
                                         CreateTabbarRKMenu(cti);
                                         Explorer.NavigationLog.CurrentLocation.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                         cti.TabIcon = Explorer.NavigationLog.CurrentLocation.Thumbnail.BitmapSource;
                                         cti.Header = Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default);
                                         cti.Path = Explorer.NavigationLog.CurrentLocation;
                                         cti.Index = 0;
                                         cti.log.CurrentLocation = Explorer.NavigationLog.CurrentLocation;
                                         cti.CloseTab += new RoutedEventHandler(cti_CloseTab);
                                         tabControl1.Items.Add(cti);
                                         //tabControl1.SelectedIndex = 0;
                                         //CurrentTabIndex = tabControl1.SelectedIndex;
                                     }
                                     else
                                     {
                                         if (Tabs.Length == 0 || !IsrestoreTabs)
                                         {
                                             if (StartUpLocation.IndexOf("::") == 0 && StartUpLocation.IndexOf(@"\") == -1)
                                                 Explorer.Navigate(ShellObject.FromParsingName("shell:" + StartUpLocation));
                                             else
                                                 try
                                                 {
                                                     Explorer.Navigate(ShellObject.FromParsingName(StartUpLocation));
                                                 }
                                                 catch
                                                 {
                                                     Explorer.Navigate((ShellObject)KnownFolders.Libraries);
                                                 }
                                         }
                                         if (IsrestoreTabs)
                                         {
                                             isOnLoad = true;
                                             int i = 0;
                                             foreach (string str in Tabs)
                                             {
                                                 try
                                                 {
                                                     i++;
                                                     if (i == Tabs.Length)
                                                     {
                                                         NewTab(str, true);
                                                     }
                                                     else
                                                     {
                                                         NewTab(str, false);
                                                     }
                                                     if (i == Tabs.Count())
                                                     {
                                                         if (str.IndexOf("::") == 0)
                                                         {

                                                             Explorer.Navigate(ShellObject.FromParsingName("shell:" + str));
                                                         }
                                                         else
                                                             Explorer.Navigate(ShellObject.FromParsingName(str.Replace("\"", "")));
                                                         (tabControl1.SelectedItem as CloseableTabItem).Path = Explorer.NavigationLog.CurrentLocation;
                                                     }
                                                 }
                                                 catch
                                                 {
                                                     //AddToLog(String.Format("Unable to load {0} into a tab!", str));
                                                     MessageBox.Show("BetterExplorer is unable to load one of the tabs from your last session. Your other tabs are perfectly okay though! \r\n\r\nThis location was unable to be loaded: " + str, "Unable to Create New Tab", MessageBoxButton.OK, MessageBoxImage.Error);
                                                     //NewTab();
                                                 }

                                             }
                                             if (tabControl1.Items.Count == 0) { 
                                                 NewTab();
                                                 if (StartUpLocation.IndexOf("::") == 0)
                                                 {

                                                     Explorer.Navigate(ShellObject.FromParsingName("shell:" + StartUpLocation));
                                                 }
                                                 else
                                                     Explorer.Navigate(ShellObject.FromParsingName(StartUpLocation.Replace("\"", "")));
                                                 (tabControl1.SelectedItem as CloseableTabItem).Path = Explorer.NavigationLog.CurrentLocation;
                                             };
                                             isOnLoad = false;

                                         }
                                     }

                                     //sets up Jump List
                                     AppJL.ShowRecentCategory = true;
                                     AppJL.ShowFrequentCategory = true;
                                     JumpList.SetJumpList(Application.Current, AppJL);
                                     JumpTask newTab = new JumpTask();
                                     newTab.ApplicationPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                                     newTab.Arguments = "t";
                                     newTab.Title = "Open Tab";
                                     newTab.Description = "Opens new tab with default location";

                                     JumpTask newWindow = new JumpTask();
                                     newWindow.ApplicationPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                                     newWindow.Arguments = "/nw";
                                     newWindow.Title = "New Window";
                                     newWindow.Description = "Creates a new window with default location";

                                     AppJL.JumpItems.Add(newTab);
                                     AppJL.JumpItems.Add(newWindow); 
                                     AppJL.Apply();


                                     //Setup Clipboard monitor
                                     cbm.ClipboardChanged += new EventHandler<ClipboardChangedEventArgs>(cbm_ClipboardChanged);

                                   #region unneeded code
                                   //if (Tabs.Length == 0 || !IsrestoreTabs)
                                   //{
                                   //    CloseableTabItem cti = new CloseableTabItem();
                                   //    CreateTabbarRKMenu(cti);
                                   //    Explorer.NavigationLog.CurrentLocation.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                   //    cti.TabIcon = Explorer.NavigationLog.CurrentLocation.Thumbnail.BitmapSource;
                                   //    cti.Header = Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default);
                                   //    cti.Path = Explorer.NavigationLog.CurrentLocation;
                                   //    cti.Index = 0;
                                   //    cti.log.CurrentLocation = Explorer.NavigationLog.CurrentLocation;
                                   //    cti.CloseTab += new RoutedEventHandler(cti_CloseTab);
                                   //    tabControl1.Items.Add(cti);
                                   //    tabControl1.SelectedIndex = 0;
                                   //    CurrentTabIndex = tabControl1.SelectedIndex;
                                   //} 
                                   #endregion
                                     


                                 }
               ));

                if (exitApp)
                {

                    Application.Current.Shutdown();
                    return;
                }

                try
                {

                    Updater = UpdateManager.Instance;
                    Updater.UpdateFeedReader = new NAppUpdate.Framework.FeedReaders.NauXmlFeedReader();
                    Updater.UpdateExecutableName = "Web Update.exe";
                    Updater.UpdateSource = new NAppUpdate.Framework.Sources.SimpleWebSource("http://better-explorer.com/onlineupdate/update.xml");
                    //TODO: reeable updates when there is site ready
                    //CheckForUpdate(false);
                }
                catch (IOException)
                {
                    this.stiUpdate.Content = "Switch to another BetterExplorer window or restart to check for updates.";
                    this.btnUpdateCheck.IsEnabled = false;
                }

                verNumber.Content = "Version " + (System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault() as AssemblyInformationalVersionAttribute).InformationalVersion;
                lblArchitecture.Content = Is64bitProcess(Process.GetCurrentProcess()) ? "64-bit version" : "32-bit version";
                if (!TheRibbon.IsMinimized)
                {
                    TheRibbon.SelectedTabItem = HomeTab;
                    this.TheRibbon.SelectedTabIndex = 0;
                }


                //MessageBox.Show(TheRibbon.SelectedTabIndex.ToString(), "SelectedTabIndex Should be 0", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception exe)
            {
                MessageBox.Show("An error occurred while loading the window. Please report this issue at http://bexplorer.codeplex.com/. \r\n\r\n Here is some information about the error: \r\n\r\n" + exe.Message + "\r\n\r\n" + exe.ToString(), "Error While Loading", MessageBoxButton.OK, MessageBoxImage.Error);
            }

        }
示例#10
0
    void ShellListView_OnListViewColumnDropDownClicked(object sender, ListViewColumnDropDownArgs e) {
      //TODO: Add Events for when an item's check has been changed
      var packUri = "pack://application:,,,/BetterExplorer;component/Images/stack16.png";
      var menu = new ListviewColumnDropDown() {
        Placement = PlacementMode.AbsolutePoint,
        HorizontalOffset = e.ActionPoint.X,
        VerticalOffset = e.ActionPoint.Y,
        IsOpen = true,
        StaysOpen = true,
      };

      var Things = new List<string>();
      var SelectedColumn = this._ShellListView.Collumns[e.ColumnIndex];
      if (SelectedColumn.CollumnType == typeof(String)) {
        Things.AddRange(new[] { "0 - 9", "A - H", "I - P", "Q - Z", "Other" });
      } else if (SelectedColumn.CollumnType == typeof(DateTime)) {
        var Container = new ItemsControl();
        Container.Items.Add(new MenuItem() { Icon = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource, Header = "Select a date or date range:", HorizontalContentAlignment = HorizontalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, IsCheckable = true, StaysOpenOnClick = true });
        Container.Items.Add(new Calendar() { SelectionMode = CalendarSelectionMode.SingleRange, Margin = new Thickness(30, 0, 0, 0) });
        menu.AddItem(Container);

        Things.AddRange(new[] { "A long time ago", "Earlier this year", "Earlier this month", "Last week", "Today" });
      } else if (SelectedColumn.CollumnType == typeof(long)) {
        Things.AddRange(new[] { "Tiny (0 - 10 KB)", "Small (10 - 100 KB)", "Medium (100 KB - 1 MB)", "Large (1 - 16 MB)", "Huge (16 - 128 MB)", "Unspecified" });
      } else if (SelectedColumn.CollumnType == typeof(Type)) {
        var distictItems = this._ShellListView.Items.Select(s => s.GetPropertyValue(SelectedColumn.pkey, SelectedColumn.CollumnType).Value).Distinct().Cast<String>().ToArray().OrderBy(o => o);
        Things.AddRange(distictItems);
      }

      foreach (var item in Things) {
        var mnuItem = new MenuItem() {
          Icon = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource,
          IsCheckable = true,
          Header = item,
          HorizontalContentAlignment = HorizontalAlignment.Stretch,
          HorizontalAlignment = HorizontalAlignment.Stretch,
          StaysOpenOnClick = true
        };

        mnuItem.Click += new RoutedEventHandler(delegate (object s, RoutedEventArgs re) {
          var over = Mouse.DirectlyOver;
          if (!(over is Image)) {
            menu.IsOpen = false;
          }
        });
        menu.AddItem(mnuItem);
      }
    }
示例#11
0
    /// <summary>
    /// Adds all default items to <see cref="btnFavorites"/>
    /// </summary>
    /// <remarks>
    /// 1. Sets OpenFavorites's OnClick event to open <see cref="KnownFolders.Links"/>
    /// 2. Adds all links from <see cref="KnownFolders.Links"/> that are not hidden 
    /// </remarks>
    private void SetUpFavoritesMenu() {
      Dispatcher.BeginInvoke(DispatcherPriority.Render, (ThreadStart)(() => {
        btnFavorites.Visibility = Visibility.Visible;

        var OpenFavorites = new MenuItem() { Header = "Open Favorites" };
        var Path = ((ShellItem)KnownFolders.Links).FileSystemPath;
        OpenFavorites.Click += (x, y) => Process.Start(Path);

        btnFavorites.Items.Add(OpenFavorites);
        btnFavorites.Items.Add(new Separator());

        foreach (ShellItem item in KnownFolders.Links.Where(w => !w.IsHidden)) {
          item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
          item.Thumbnail.CurrentSize = new WIN.Size(16, 16);
          btnFavorites.Items.Add(Utilities.Build_MenuItem(item.GetDisplayName(SIGDN.NORMALDISPLAY), item, item.Thumbnail.BitmapSource, onClick: mif_Click));
        }
      }));
    }
示例#12
0
        private DropDownButton CreateDropDown(object parameter, ToolbarElement element, bool isContextual, Func <object> getContext)
        {
            var command = element.Element as ICommand;

            if (command == null)
            {
                return(null);
            }

            var icon = Icon.Empty;

            if (element.Icon != null)
            {
                icon = new Icon(element.Icon);
            }

            var iconSource = icon.GetSource();

            var button = new DropDownButton
            {
                Header    = !string.IsNullOrEmpty(element.Text) ? element.Text : command.Text,
                IsEnabled = command.CanExecute(parameter),
                Icon      = iconSource,
                LargeIcon = iconSource,
            };

            button.DropDownOpened += delegate
            {
                button.Items.Clear();

                var submenuCommand = command;
                if (submenuCommand == null)
                {
                    return;
                }

                var context = getContext();
                if (context == null)
                {
                    return;
                }

                var commands = submenuCommand.GetSubmenuCommands(context).ToList();

                string group = null;
                foreach (var c in commands.OrderBy(c => c.SortingValue).ThenBy(c => c.Text))
                {
                    var cmd = c;

                    if (cmd.Group != group)
                    {
                        if (group != null)
                        {
                            button.Items.Add(new Separator());
                        }

                        group = cmd.Group;
                    }

                    var menuItem = new Fluent.MenuItem
                    {
                        Header    = cmd.Text,
                        IsChecked = cmd.IsChecked
                    };

                    if (!string.IsNullOrEmpty(command.ToolTip))
                    {
                        menuItem.ToolTip = command.ToolTip;
                    }

                    if (!string.IsNullOrEmpty(command.InputGestureText))
                    {
                        menuItem.KeyTip = command.InputGestureText;
                    }

                    if (cmd.Icon != null && cmd.Icon != Icon.Empty)
                    {
                        menuItem.Icon = cmd.Icon.GetSource();
                    }

                    menuItem.Click += delegate
                    {
                        if (cmd.CanExecute(context))
                        {
                            cmd.Execute(context);
                        }
                    };

                    button.Items.Add(menuItem);
                }
            };

            if (!string.IsNullOrEmpty(command.ToolTip))
            {
                button.ToolTip = command.ToolTip;
            }

            if (!string.IsNullOrEmpty(command.InputGestureText))
            {
                button.KeyTip = command.InputGestureText;
            }

            if (!isContextual)
            {
                _toolbarButtons[button] = command;
            }

            return(button);
        }
示例#13
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.fmMain = ((LEDX.MWin)(target));
                return;

            case 2:
                this.ribbon = ((Fluent.Ribbon)(target));

            #line 57 "..\..\MainWindow.xaml"
                this.ribbon.SelectedTabChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.Ribbon_SelectedTabChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.btNewProj = ((Fluent.Button)(target));
                return;

            case 4:
                this.btOpenProj = ((Fluent.Button)(target));
                return;

            case 5:
                this.btSaveProj = ((Fluent.Button)(target));
                return;

            case 6:
                this.tbEdit = ((Fluent.RibbonTabItem)(target));
                return;

            case 7:
                this.btUndo = ((Fluent.SplitButton)(target));
                return;

            case 8:
                this.btPasteFram = ((Fluent.SplitButton)(target));
                return;

            case 9:
                this.rgbContrProp = ((Fluent.RibbonGroupBox)(target));
                return;

            case 10:
                this.spAddNew = ((Fluent.SplitButton)(target));
                return;

            case 11:
                this.btDel = ((Fluent.MenuItem)(target));
                return;

            case 12:
                this.tbConName = ((Fluent.TextBox)(target));
                return;

            case 13:
                this.tbConNumb = ((Fluent.Spinner)(target));
                return;

            case 14:
                this.tbConButt = ((Fluent.Spinner)(target));
                return;

            case 15:
                this.rgbFrameProp = ((Fluent.RibbonGroupBox)(target));
                return;

            case 16:
                this.spTime = ((Fluent.Spinner)(target));
                return;

            case 17:
                this.btCopyFram = ((Fluent.Button)(target));
                return;

            case 18:
                this.btCutFram = ((Fluent.Button)(target));
                return;

            case 19:
                this.btDelFram = ((Fluent.Button)(target));
                return;

            case 20:
                this.btToSample = ((Fluent.Button)(target));
                return;

            case 21:
                this.spbtFSet = ((Fluent.SplitButton)(target));

            #line 179 "..\..\MainWindow.xaml"
                this.spbtFSet.DropDownClosed += new System.EventHandler(this.SpbtFSet_DropDownClosed);

            #line default
            #line hidden
                return;

            case 22:
                this.rgbColorProp = ((Fluent.RibbonGroupBox)(target));
                return;

            case 23:
                this.btBegColor = ((Fluent.Button)(target));
                return;

            case 24:
                this.rctBegClolor = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 25:
                this.btCopyColor = ((Fluent.Button)(target));
                return;

            case 26:
                this.btGetColor = ((Fluent.Button)(target));
                return;

            case 27:
                this.btEndColor = ((Fluent.Button)(target));
                return;

            case 28:
                this.rctEndClolor = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 29:
                this.btCopy = ((Fluent.Button)(target));
                return;

            case 30:
                this.grSampl = ((Fluent.InRibbonGallery)(target));
                return;

            case 31:
                this.tbPalyer = ((Fluent.RibbonTabItem)(target));
                return;

            case 32:
                this.rgbPropLayer = ((Fluent.RibbonGroupBox)(target));
                return;

            case 33:
                this.btLayerDown = ((Fluent.Button)(target));
                return;

            case 34:
                this.btLayerTop = ((Fluent.Button)(target));
                return;

            case 35:
                this.btDelLay = ((Fluent.Button)(target));
                return;

            case 36:
                this.rgbPropPng = ((Fluent.RibbonGroupBox)(target));
                return;

            case 37:
                this.cbController = ((Fluent.ComboBox)(target));
                return;

            case 38:
                this.lgWidth = ((Fluent.TextBox)(target));
                return;

            case 39:
                this.lgHeight = ((Fluent.TextBox)(target));
                return;

            case 40:
                this.rgbPropText = ((Fluent.RibbonGroupBox)(target));
                return;

            case 41:
                this.lbtemTest = ((System.Windows.Controls.Label)(target));
                return;

            case 42:
                this.temTest = ((LEDX.Components.MultiLineTextEditor)(target));
                return;

            case 43:
                this.spTextSize = ((Fluent.Spinner)(target));
                return;

            case 44:
                this.cbFontFamaly = ((Fluent.ComboBox)(target));
                return;

            case 45:
                this.rctTextClolor = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 46:
                this.tbFlash = ((Fluent.RibbonTabItem)(target));
                return;

            case 47:
                this.lbPort = ((System.Windows.Controls.Label)(target));
                return;

            case 48:
                this.cbComName = ((Fluent.ComboBox)(target));
                return;

            case 49:
                this.lbSpeed = ((System.Windows.Controls.Label)(target));
                return;

            case 50:
                this.cbComRate = ((Fluent.ComboBox)(target));
                return;

            case 51:
                this.btRefrPorts = ((Fluent.Button)(target));
                return;

            case 52:
                this.tbSync = ((Fluent.ToggleButton)(target));
                return;

            case 53:
                this.tgbShowLog = ((Fluent.ToggleButton)(target));
                return;

            case 54:
                this.spProgress = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 55:
                this.uiScaleSlider = ((System.Windows.Controls.Slider)(target));

            #line 531 "..\..\MainWindow.xaml"
                this.uiScaleSlider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.uiScaleSlider_ValueChanged);

            #line default
            #line hidden
                return;

            case 56:
                this.uiMan = ((LEDX.Components.PlayScale)(target));
                return;

            case 57:
                this.svSearch = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 58:
                this.sldTime = ((LEDX.Components.TimeSlider)(target));

            #line 561 "..\..\MainWindow.xaml"
                this.sldTime.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.sld_ValueChanged);

            #line default
            #line hidden
                return;

            case 59:
                this.scroll = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 60:
                this.icContr = ((System.Windows.Controls.ItemsControl)(target));
                return;

            case 61:
                this.svTracks = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 62:
                this.icTrack = ((System.Windows.Controls.ItemsControl)(target));
                return;

            case 63:
                this.iCanv = ((LEDX.Components.IncRender)(target));

            #line 598 "..\..\MainWindow.xaml"
                this.iCanv.SelectionChanged += new System.EventHandler(this.iCanv_SelectionChanged);

            #line default
            #line hidden
                return;

            case 64:
                this.mainScroller = ((System.Windows.Controls.ScrollViewer)(target));

            #line 607 "..\..\MainWindow.xaml"
                this.mainScroller.ScrollChanged += new System.Windows.Controls.ScrollChangedEventHandler(this.mainScroller_ScrollChanged);

            #line default
            #line hidden
                return;

            case 65:
                this.svLog = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 66:
                this.tbLog = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#14
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 6 "..\..\..\MainWindow.xaml"
                ((jg.Editor.MainWindow)(target)).KeyUp += new System.Windows.Input.KeyEventHandler(this.RibbonWindow_KeyUp);

            #line default
            #line hidden

            #line 9 "..\..\..\MainWindow.xaml"
                ((jg.Editor.MainWindow)(target)).PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.RibbonWindow_PreviewMouseDown);

            #line default
            #line hidden

            #line 10 "..\..\..\MainWindow.xaml"
                ((jg.Editor.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 11 "..\..\..\MainWindow.xaml"
                ((jg.Editor.MainWindow)(target)).Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden
                return;

            case 8:

            #line 82 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 82 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 9:

            #line 83 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 83 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 10:

            #line 84 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 84 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 11:

            #line 85 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 85 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 12:

            #line 86 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 86 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 13:

            #line 87 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 87 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 14:

            #line 88 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 88 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 15:

            #line 89 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute);

            #line default
            #line hidden

            #line 89 "..\..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed);

            #line default
            #line hidden
                return;

            case 16:
                this.col1 = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 17:
                this.col5 = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 18:
                this.rowStage = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 19:
                this.row4 = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 20:
                this.tabControl1 = ((System.Windows.Controls.TabControl)(target));
                return;

            case 21:
                this.ribbon = ((Fluent.Ribbon)(target));
                return;

            case 22:
                this.invisibleTabGroup = ((Fluent.RibbonContextualTabGroup)(target));
                return;

            case 23:

            #line 177 "..\..\..\MainWindow.xaml"
                ((Fluent.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_8);

            #line default
            #line hidden
                return;

            case 24:

            #line 181 "..\..\..\MainWindow.xaml"
                ((Fluent.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_7);

            #line default
            #line hidden
                return;

            case 25:
                this.tabItem1 = ((Fluent.RibbonTabItem)(target));
                return;

            case 26:
                this.Clipboard = ((Fluent.RibbonGroupBox)(target));
                return;

            case 27:
                this.btnCreate = ((System.Windows.Controls.Button)(target));

            #line 342 "..\..\..\MainWindow.xaml"
                this.btnCreate.Click += new System.Windows.RoutedEventHandler(this.btnCreate_Click);

            #line default
            #line hidden
                return;

            case 28:
                this.btnLoad = ((System.Windows.Controls.Button)(target));

            #line 365 "..\..\..\MainWindow.xaml"
                this.btnLoad.Click += new System.Windows.RoutedEventHandler(this.btnLoad_Click);

            #line default
            #line hidden
                return;

            case 29:
                this.btnClone = ((System.Windows.Controls.Button)(target));

            #line 387 "..\..\..\MainWindow.xaml"
                this.btnClone.Click += new System.Windows.RoutedEventHandler(this.btnClone_Click);

            #line default
            #line hidden
                return;

            case 30:
                this.btnPageAdd = ((System.Windows.Controls.Button)(target));

            #line 409 "..\..\..\MainWindow.xaml"
                this.btnPageAdd.Click += new System.Windows.RoutedEventHandler(this.btnPageAdd_Click);

            #line default
            #line hidden
                return;

            case 31:

            #line 422 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 32:

            #line 423 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 33:
                this.btnPageDel = ((System.Windows.Controls.Button)(target));

            #line 429 "..\..\..\MainWindow.xaml"
                this.btnPageDel.Click += new System.Windows.RoutedEventHandler(this.btnPageDel_Click);

            #line default
            #line hidden
                return;

            case 34:
                this.btnCut = ((System.Windows.Controls.Button)(target));

            #line 442 "..\..\..\MainWindow.xaml"
                this.btnCut.Click += new System.Windows.RoutedEventHandler(this.btnCut_Click);

            #line default
            #line hidden
                return;

            case 35:
                this.btnCopy = ((System.Windows.Controls.Button)(target));

            #line 465 "..\..\..\MainWindow.xaml"
                this.btnCopy.Click += new System.Windows.RoutedEventHandler(this.btnCopy_Click);

            #line default
            #line hidden
                return;

            case 36:
                this.btnPaste = ((System.Windows.Controls.Button)(target));

            #line 488 "..\..\..\MainWindow.xaml"
                this.btnPaste.Click += new System.Windows.RoutedEventHandler(this.btnPaste_Click);

            #line default
            #line hidden
                return;

            case 37:
                this.Preview = ((System.Windows.Controls.Button)(target));

            #line 511 "..\..\..\MainWindow.xaml"
                this.Preview.Click += new System.Windows.RoutedEventHandler(this.Preview_Click);

            #line default
            #line hidden
                return;

            case 38:
                this.btnPublish = ((System.Windows.Controls.Button)(target));

            #line 525 "..\..\..\MainWindow.xaml"
                this.btnPublish.Click += new System.Windows.RoutedEventHandler(this.btnPublish_Click);

            #line default
            #line hidden
                return;

            case 39:
                this.btnUndo = ((System.Windows.Controls.Button)(target));

            #line 539 "..\..\..\MainWindow.xaml"
                this.btnUndo.Click += new System.Windows.RoutedEventHandler(this.btnUndo_Click);

            #line default
            #line hidden
                return;

            case 40:
                this.btnRedo = ((System.Windows.Controls.Button)(target));

            #line 566 "..\..\..\MainWindow.xaml"
                this.btnRedo.Click += new System.Windows.RoutedEventHandler(this.btnRedo_Click);

            #line default
            #line hidden
                return;

            case 41:
                this.toggleButton1 = ((System.Windows.Controls.Primitives.ToggleButton)(target));
                return;

            case 42:
                this.popup1 = ((System.Windows.Controls.Primitives.Popup)(target));
                return;

            case 43:

            #line 613 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AlignButton_Click);

            #line default
            #line hidden
                return;

            case 44:

            #line 616 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AlignButton_Click);

            #line default
            #line hidden
                return;

            case 45:

            #line 619 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AlignButton_Click);

            #line default
            #line hidden
                return;

            case 46:

            #line 622 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.AlignButton_Click);

            #line default
            #line hidden
                return;

            case 47:
                this.tabItem2 = ((Fluent.RibbonTabItem)(target));
                return;

            case 48:
                this.ResourcesRibbonGroupBox = ((Fluent.RibbonGroupBox)(target));
                return;

            case 49:
                this.localImgMenu = ((Fluent.MenuItem)(target));
                return;

            case 50:
                this.localMovieMenu = ((Fluent.MenuItem)(target));
                return;

            case 51:
                this.localSoundMenu = ((Fluent.MenuItem)(target));
                return;

            case 52:
                this.localDocumentMenu = ((Fluent.MenuItem)(target));
                return;

            case 53:
                this.localTPageGroupMenu = ((Fluent.MenuItem)(target));
                return;

            case 54:

            #line 721 "..\..\..\MainWindow.xaml"
                ((Fluent.SplitButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SplitButton_Click);

            #line default
            #line hidden
                return;

            case 55:

            #line 736 "..\..\..\MainWindow.xaml"
                ((Fluent.SplitButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SplitButton_Click);

            #line default
            #line hidden
                return;

            case 56:

            #line 750 "..\..\..\MainWindow.xaml"
                ((Fluent.SplitButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SplitButton_Click);

            #line default
            #line hidden
                return;

            case 57:

            #line 765 "..\..\..\MainWindow.xaml"
                ((Fluent.SplitButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SplitButton_Click);

            #line default
            #line hidden
                return;

            case 58:

            #line 779 "..\..\..\MainWindow.xaml"
                ((Fluent.SplitButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SplitButton_Click);

            #line default
            #line hidden
                return;

            case 59:
                this.Shape001 = ((System.Windows.Shapes.Path)(target));
                return;

            case 60:
                this.Shape002 = ((System.Windows.Shapes.Path)(target));
                return;

            case 61:
                this.Shape003 = ((System.Windows.Shapes.Path)(target));
                return;

            case 62:
                this.Shape004 = ((System.Windows.Shapes.Path)(target));
                return;

            case 63:
                this.Shape005 = ((System.Windows.Shapes.Path)(target));
                return;

            case 64:
                this.Shape006 = ((System.Windows.Shapes.Path)(target));
                return;

            case 65:
                this.Shape007 = ((System.Windows.Shapes.Path)(target));
                return;

            case 66:
                this.Shape008 = ((System.Windows.Shapes.Path)(target));
                return;

            case 67:
                this.Shape009 = ((System.Windows.Shapes.Path)(target));
                return;

            case 68:
                this.Shape010 = ((System.Windows.Shapes.Path)(target));
                return;

            case 69:
                this.Shape011 = ((System.Windows.Shapes.Path)(target));
                return;

            case 70:
                this.Shape012 = ((System.Windows.Shapes.Path)(target));
                return;

            case 71:
                this.Shape013 = ((System.Windows.Shapes.Path)(target));
                return;

            case 72:
                this.Shape014 = ((System.Windows.Shapes.Path)(target));
                return;

            case 73:
                this.Shape015 = ((System.Windows.Shapes.Path)(target));
                return;

            case 74:
                this.Shape016 = ((System.Windows.Shapes.Path)(target));
                return;

            case 75:
                this.Shape017 = ((System.Windows.Shapes.Path)(target));
                return;

            case 76:

            #line 893 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_6);

            #line default
            #line hidden
                return;

            case 77:
                this.treeViewControl1 = ((System.Windows.Controls.TreeView)(target));

            #line 896 "..\..\..\MainWindow.xaml"
                this.treeViewControl1.SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler <object>(this.treeViewControl1_SelectedItemChanged);

            #line default
            #line hidden

            #line 897 "..\..\..\MainWindow.xaml"
                this.treeViewControl1.Drop += new System.Windows.DragEventHandler(this.PubDropTreeAndBlockEvent);

            #line default
            #line hidden
                return;

            case 78:
                this.scrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 79:
                this.grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 80:
                this.scaleTransform = ((System.Windows.Media.ScaleTransform)(target));
                return;

            case 81:
                this.propertyManage1 = ((jg.Editor.Library.Property.PropertyManage)(target));
                return;

            case 82:

            #line 931 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_5);

            #line default
            #line hidden
                return;

            case 83:

            #line 944 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_5);

            #line default
            #line hidden
                return;

            case 84:

            #line 958 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_5);

            #line default
            #line hidden
                return;

            case 85:

            #line 965 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 86:

            #line 966 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);

            #line default
            #line hidden
                return;

            case 87:

            #line 967 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2);

            #line default
            #line hidden
                return;

            case 88:

            #line 968 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_3);

            #line default
            #line hidden
                return;

            case 89:

            #line 969 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_4);

            #line default
            #line hidden
                return;

            case 90:
                this.controlTimeLine = ((jg.Editor.Library.ControlTimeLine)(target));
                return;

            case 91:
                this.zoomSlider = ((System.Windows.Controls.Slider)(target));
                return;

            case 92:
                this.ShowNewWin = ((System.Windows.Controls.Grid)(target));
                return;

            case 93:
                this.ProgressEditBusyName = ((jg.Editor.Library.Control.ProgressEditBusy)(target));
                return;
            }
            this._contentLoaded = true;
        }
        private static FrameworkElement GetRibbonButton(MainWindow window, Func <string, ImageSource> getImage, XmlElement button, RibbonGroupBox ribbonGroup, IMainWindowButton mainWindowButton)
        {
            var header = button.GetNonEmptyAttribute("label");

            var clickHandler = GetClickHandler(mainWindowButton);

            if (button.ChildNodes.Count == 0)
            {
                // create Ribbon Button
                var imageSource  = getImage(button.GetNonEmptyAttribute("largeImage"));
                var fluentButton = new Fluent.Button
                {
                    Icon      = imageSource,
                    LargeIcon = imageSource,
                    Header    = header
                };
                fluentButton.Click += clickHandler;
                ribbonGroup.Items.Add(fluentButton);
                return(fluentButton);
            }

            // create Ribbon Button
            var splitButton = ribbonGroup.Items.OfType <SplitButton>().SingleOrDefault(x => Extensions.EqualsIgnoreCase(x.Header.ToString().Trim(), header.Trim()));

            if (splitButton == null)
            {
                var imageSource = getImage(button.GetNonEmptyAttribute("largeImage"));
                splitButton = new Fluent.SplitButton
                {
                    Icon      = imageSource,
                    LargeIcon = imageSource,
                    Header    = header
                };

                if (mainWindowButton != null)
                {
                    splitButton.Click += clickHandler;
                }
                else
                {
                    var childrenButtons = new List <KeyValuePair <string, IMainWindowButton> >();
                    splitButton.Tag    = childrenButtons;
                    splitButton.Click += (sender, args) => splitButton.IsDropDownOpen = true;
                }

                ribbonGroup.Items.Add(splitButton);
            }

            var items = splitButton.Items;

            Assert.IsNotNull(items, nameof(items));

            foreach (var menuItem in button.ChildNodes.OfType <XmlElement>())
            {
                if (menuItem == null)
                {
                    continue;
                }

                try
                {
                    var name = menuItem.Name;
                    if (name.EqualsIgnoreCase("separator"))
                    {
                        items.Add(new Separator());
                        continue;
                    }

                    if (!name.EqualsIgnoreCase("button"))
                    {
                        Log.Error($"This element is not supported as SplitButton element: {menuItem.OuterXml}");
                        continue;
                    }

                    var menuHeader  = menuItem.GetAttribute("label");
                    var largeImage  = menuItem.GetAttribute("largeImage");
                    var menuIcon    = string.IsNullOrEmpty(largeImage) ? null : getImage(largeImage);
                    var menuHandler = (IMainWindowButton)Plugin.CreateInstance(menuItem);
                    Assert.IsNotNull(menuHandler, nameof(menuHandler));

                    var childrenButtons = splitButton.Tag as ICollection <KeyValuePair <string, IMainWindowButton> >;
                    if (childrenButtons != null)
                    {
                        childrenButtons.Add(new KeyValuePair <string, IMainWindowButton>(menuHeader, menuHandler));
                    }

                    var menuButton = new Fluent.MenuItem()
                    {
                        Header    = menuHeader,
                        IsEnabled = menuHandler.IsEnabled(window, SelectedInstance)
                    };

                    if (menuIcon != null)
                    {
                        menuButton.Icon = menuIcon;
                    }

                    // bind IsEnabled event
                    SetIsEnabledProperty(menuButton, menuHandler);

                    menuButton.Click += delegate
                    {
                        try
                        {
                            if (menuHandler.IsEnabled(MainWindow.Instance, SelectedInstance))
                            {
                                menuHandler.OnClick(MainWindow.Instance, SelectedInstance);
                                MainWindowHelper.RefreshInstances();
                            }
                        }
                        catch (Exception ex)
                        {
                            WindowHelper.HandleError("Error during handling menu button click: " + menuHandler.GetType().FullName, true, ex);
                        }
                    };

                    items.Add(menuButton);
                }
                catch (Exception ex)
                {
                    WindowHelper.HandleError("Error during initializing ribbon button: " + menuItem.OuterXml, true, ex);
                }
            }

            return(splitButton);
        }
 /// <summary>
 /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
 /// </summary>
 public override void OnApplyTemplate()
 {
     gallery = GetTemplateChild("PART_Gallery") as Gallery;
     if (gallery != null)gallery.ItemsSource = data;
     noColorMenuItem = GetTemplateChild("PART_NoColorMenuItem") as MenuItem;
     if (noColorMenuItem != null) noColorMenuItem.IsChecked = SelectedBrush.Color == Colors.Transparent;
 }
示例#17
0
    /// <summary>
    /// Sets up btnSort and btnGroup so they have the correct items after navigating 
    /// </summary>
    private void SetSortingAndGroupingButtons() {
      btnSort.Items.Clear();
      btnGroup.Items.Clear();

      try {
        foreach (Collumns item in _ShellListView.Collumns.Where(x => x != null)) {
          var lastSortedColumn = _ShellListView.Collumns.FirstOrDefault(w => w.ID == this._ShellListView.LastSortedColumnId);
          if (lastSortedColumn != null) {
            var IsChecked1 = (item.pkey.fmtid == lastSortedColumn.pkey.fmtid) && (item.pkey.pid == lastSortedColumn.pkey.pid);
            btnSort.Items.Add(Utilities.Build_MenuItem(item.Name, item, checkable: true, isChecked: IsChecked1, GroupName: "GR2", onClick: mi_Click));
          }
          var IsCheckable2 = _ShellListView.LastGroupCollumn != null && (item.pkey.fmtid == _ShellListView.LastGroupCollumn.pkey.fmtid) && (item.pkey.pid == _ShellListView.LastGroupCollumn.pkey.pid);
          btnGroup.Items.Add(Utilities.Build_MenuItem(item.Name, item, checkable: true, isChecked: IsCheckable2, GroupName: "GR3", onClick: mig_Click));
        }
      } catch (Exception ex) {
        //FIXME: I disable this message because of strange null after filter
        MessageBox.Show("BetterExplorer had an issue loading the visible columns for the current view. You might not be able to sort or group items.", ex.ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
      }

      btnSort.Items.Add(new Separator() { Focusable = false });
      misa = Utilities.Build_MenuItem(FindResource("miAscending"), checkable: true, GroupName: "GR1", onClick: misa_Click);
      misd = Utilities.Build_MenuItem(FindResource("miDescending"), checkable: true, GroupName: "GR1", onClick: misd_Click);

      if (this._ShellListView.LastSortOrder == WIN.Forms.SortOrder.Ascending)
        misa.IsChecked = true;
      else
        misd.IsChecked = true;

      btnSort.Items.Add(misa);
      btnSort.Items.Add(misd);

      btnGroup.Items.Add(Utilities.Build_MenuItem("(none)", GroupName: "GR3", checkable: true, isChecked: _ShellListView.LastGroupCollumn == null, onClick: misng_Click));
      btnGroup.Items.Add(new Separator());

      misag = Utilities.Build_MenuItem(FindResource("miAscending"), checkable: true, GroupName: "GR4", onClick: misag_Click);
      misdg = Utilities.Build_MenuItem(FindResource("miDescending"), checkable: true, GroupName: "GR4", onClick: misag_Click);

      if (this._ShellListView.LastGroupOrder == WIN.Forms.SortOrder.Ascending)
        misag.IsChecked = true;
      else
        misdg.IsChecked = true;

      btnGroup.Items.Add(misag);
      btnGroup.Items.Add(misdg);
    }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            ShellContainer con = (ShellContainer)this.ShellObject;
            List<ShellObject> joe = new List<ShellObject>();
            foreach (ShellObject item in con)
            {
                if (item.IsFolder)
                {
                    if (!item.ParsingName.EndsWith(".zip"))
                    {
                        joe.Add(item);
                    }
                }
            }

            joe.Sort(delegate(ShellObject j1, ShellObject j2) { return j1.GetDisplayName(DisplayNameType.Default).CompareTo(j2.GetDisplayName(DisplayNameType.Default)); });
            DropDownMenu.Items.Clear();
            foreach (ShellObject thing in joe)
            {
                Fluent.MenuItem pan = new Fluent.MenuItem();
                thing.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                thing.Thumbnail.CurrentSize = new Size(16, 16);
                pan.Icon = thing.Thumbnail.BitmapSource;
                pan.Header = thing.GetDisplayName(DisplayNameType.Default);
                pan.Height = 23;
                pan.Tag = thing;
                pan.Click += new RoutedEventHandler(MenuItemClicked);
                this.DropDownMenu.Items.Add(pan);
            }
            if (DropDownMenu.Items.Count > 0)
            {
                DropDownMenu.Placement = PlacementMode.Bottom;
                DropDownMenu.PlacementTarget = Base;
                DropDownMenu.IsOpen = true;
            }

        }
示例#19
0
    private void ctrlConsole_OnConsoleInput(object sender, Tuple<string> args) {
      if (args.Item1.Trim().ToLowerInvariant().StartsWith("cd"))
        NavigationController(FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, args.Item1.ToLowerInvariant().Replace("cd", String.Empty).Replace("/d", String.Empty).Trim()));

      var cmi = new MenuItem() { Header = args.Item1 };
      cmi.Click += cmi_Click;
      this.btnConsoleHistory.Items.Add(cmi);
    }
        private static FrameworkElement GetRibbonButton(MainWindow window, Func <string, ImageSource> getImage, ButtonDefinition button, RibbonGroupBox ribbonGroup, IMainWindowButton mainWindowButton)
        {
            Assert.ArgumentNotNull(button, nameof(button));
            Assert.ArgumentNotNull(ribbonGroup, nameof(ribbonGroup));

            var header = button.Label;

            var clickHandler = GetClickHandler(mainWindowButton);

            if (button.Buttons == null || button.Buttons.Length == 0 || button.Buttons.All(x => x == null))
            {
                // create Ribbon Button
                var imageSource  = getImage(button.Image);
                var fluentButton = new Fluent.Button
                {
                    Icon      = imageSource,
                    LargeIcon = imageSource,
                    Header    = header
                };
                fluentButton.Click += clickHandler;
                ribbonGroup.Items.Add(fluentButton);
                return(fluentButton);
            }

            // create Ribbon Button
            var splitButton = ribbonGroup.Items.OfType <SplitButton>().SingleOrDefault(x => x.Header.ToString().Trim().EqualsIgnoreCase(header.Trim()));

            if (splitButton == null)
            {
                var imageSource = getImage(button.Image);
                splitButton = new Fluent.SplitButton
                {
                    Icon      = imageSource,
                    LargeIcon = imageSource,
                    Header    = header
                };

                if (mainWindowButton != null)
                {
                    splitButton.Click += clickHandler;
                }
                else
                {
                    var childrenButtons = new List <KeyValuePair <string, IMainWindowButton> >();
                    splitButton.Tag    = childrenButtons;
                    splitButton.Click += (sender, args) => splitButton.IsDropDownOpen = true;
                }

                ribbonGroup.Items.Add(splitButton);
            }

            var items = splitButton.Items;

            Assert.IsNotNull(items, nameof(items));

            foreach (var menuItem in button.Buttons)
            {
                if (menuItem == null)
                {
                    continue;
                }

                try
                {
                    var menuHeader = menuItem.Label;
                    if (string.IsNullOrEmpty(menuHeader))
                    {
                        items.Add(new Separator());
                        continue;
                    }

                    var largeImage  = menuItem.Image;
                    var menuIcon    = string.IsNullOrEmpty(largeImage) ? null : getImage(largeImage);
                    var menuHandler = menuItem.Handler;

                    var childrenButtons = splitButton.Tag as ICollection <KeyValuePair <string, IMainWindowButton> >;
                    if (childrenButtons != null)
                    {
                        childrenButtons.Add(new KeyValuePair <string, IMainWindowButton>(menuHeader, menuHandler));
                    }

                    var menuButton = new Fluent.MenuItem()
                    {
                        Header    = menuHeader,
                        IsEnabled = menuHandler?.IsEnabled(window, SelectedInstance) ?? true
                    };

                    if (menuIcon != null)
                    {
                        menuButton.Icon = menuIcon;
                    }

                    if (menuHandler != null)
                    {
                        // bind IsEnabled event
                        SetIsEnabledProperty(menuButton, menuHandler);

                        menuButton.Click += delegate
                        {
                            try
                            {
                                if (menuHandler.IsEnabled(MainWindow.Instance, SelectedInstance))
                                {
                                    menuHandler.OnClick(MainWindow.Instance, SelectedInstance);
                                    RefreshInstances();
                                }
                            }
                            catch (Exception ex)
                            {
                                WindowHelper.HandleError($"Error during handling menu button click: {menuHandler.GetType().FullName}", true, ex);
                            }
                        };
                    }

                    items.Add(menuButton);
                }
                catch (Exception ex)
                {
                    WindowHelper.HandleError($"Error during initializing ribbon button: {menuItem.Label}", true, ex);
                }
            }

            return(splitButton);
        }
示例#21
0
    private void btnEasyAccess_DropDownOpened(object sender, EventArgs e) {
      if (_ShellListView.GetSelectedCount() == 1 && _ShellListView.GetFirstSelectedItem().IsFolder) {
        mnuIncludeInLibrary.Items.Clear();

        foreach (ShellItem lib in KnownFolders.Libraries) {
          lib.Thumbnail.CurrentSize = new WIN.Size(16, 16);
          mnuIncludeInLibrary.Items.Add(Utilities.Build_MenuItem(
              lib.DisplayName, ShellLibrary.Load(Path.GetFileNameWithoutExtension(lib.ParsingName), true), lib.Thumbnail.BitmapSource, onClick: mli_Click)
          );
        }

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

        var mln = new MenuItem() { Header = "Create new library" };
        mln.Click += mln_Click;
        mnuIncludeInLibrary.Items.Add(mln);
        mnuIncludeInLibrary.IsEnabled = true;
      } else {
        mnuIncludeInLibrary.IsEnabled = false;
      }
    }
        void Explorer_NavigationPending(object sender, NavigationPendingEventArgs e)
        {

            if (fsw_AC != null)
                fsw_AC.Dispose();

            e.Cancel = IsCancel;
            if (IsAfterRename)
                breadcrumbBarControl1.ExitEditMode();

            try
            {
            
                this.Title = "Better Explorer - " + e.PendingLocation.GetDisplayName(DisplayNameType.Default);



                Dispatcher.BeginInvoke(DispatcherPriority.Render, (ThreadStart)(() =>
                                    {
                                        ConstructMoveToCopyToMenu();
                                        if (e.PendingLocation.IsFileSystemObject || e.PendingLocation.IsNetDrive || e.PendingLocation.ParsingName.StartsWith(@"\\"))
                                        {

                                            try
                                            {
                                                fsw_AC = new FileSystemWatcher(e.PendingLocation.ParsingName);
                                                fsw_AC.EnableRaisingEvents = true;
                                                fsw_AC.Created += new FileSystemEventHandler(fsw_AC_Created);
                                                fsw_AC.Deleted += new FileSystemEventHandler(fsw_AC_Deleted);
                                            }
                                            catch
                                            {

                                            }
                                        }

                                        if (e.PendingLocation.IsFileSystemObject)
	                                    {
		                                    btnSizeChart.IsEnabled = true;
	                                    }
                                        else
	                                    {
                                            btnSizeChart.IsEnabled = false;
	                                    }

                                        this.breadcrumbBarControl1.LoadDirectory(e.PendingLocation);
                                        this.breadcrumbBarControl1.LastPath = e.PendingLocation.ParsingName;
                                        IntPtr pIDL = IntPtr.Zero;

                                        try
                                        {
                                            uint iAttribute;
                                            SHParseDisplayName(e.PendingLocation.ParsingName,
                                                IntPtr.Zero, out pIDL, (uint)0, out iAttribute);

                                            WindowsAPI.SHFILEINFO sfi = new WindowsAPI.SHFILEINFO();
                                            IntPtr Res = IntPtr.Zero;
                                            if (pIDL != IntPtr.Zero)
                                            {
                                                if (!e.PendingLocation.IsFileSystemObject)
                                                {
                                                    Res = WindowsAPI.SHGetFileInfo(pIDL, 0, ref sfi, (uint)Marshal.SizeOf(sfi), WindowsAPI.SHGFI.IconLocation | WindowsAPI.SHGFI.SmallIcon | WindowsAPI.SHGFI.PIDL);
                                                }

                                            }

                                            if (e.PendingLocation.IsFileSystemObject)
                                            {
                                                WindowsAPI.SHGetFileInfo(e.PendingLocation.ParsingName, 0, ref sfi, (uint)Marshal.SizeOf(sfi), (uint)WindowsAPI.SHGFI.IconLocation | (uint)WindowsAPI.SHGFI.SmallIcon);

                                            }
                                            JumpTask JTask = new JumpTask();
                                            JTask.ApplicationPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                                            JTask.Arguments = "\"" + e.PendingLocation.ParsingName + "\"";
                                            JTask.Title = e.PendingLocation.GetDisplayName(DisplayNameType.Default);
                                            JTask.IconResourcePath = sfi.szDisplayName;
                                            JTask.IconResourceIndex = sfi.iIcon;
                                            JumpList.AddToRecentCategory(JTask);
                                            AppJL.Apply();

                                        }
                                        finally
                                        {

                                            if (pIDL != IntPtr.Zero)
                                                Marshal.FreeCoTaskMem(pIDL);
                                        }

                                        try
                                        {

                                            //CloseableTabItem it = new CloseableTabItem();
                                            //CreateTabbarRKMenu(it);
                                            e.PendingLocation.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                            e.PendingLocation.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                            (tabControl1.SelectedItem as CloseableTabItem).Header = e.PendingLocation.GetDisplayName(DisplayNameType.Default);
                                            (tabControl1.SelectedItem as CloseableTabItem).TabIcon = e.PendingLocation.Thumbnail.BitmapSource;
                                            (tabControl1.SelectedItem as CloseableTabItem).Path = e.PendingLocation;
                                            if (!isGoingBackOrForward)
                                            {
                                                (tabControl1.SelectedItem as CloseableTabItem).log.CurrentLocation = e.PendingLocation;
                                            }

                                            isGoingBackOrForward = false;

                                            leftNavBut.IsEnabled = (tabControl1.SelectedItem as CloseableTabItem).log.CanNavigateBackwards;
                                            rightNavBut.IsEnabled = (tabControl1.SelectedItem as CloseableTabItem).log.CanNavigateForwards;

                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragEnter += new DragEventHandler(newt_DragEnter);
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragLeave += new DragEventHandler(newt_DragLeave);
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).DragOver += new DragEventHandler(newt_DragOver);
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Drop += new DragEventHandler(newt_Drop);
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).AllowDrop = true;
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).Index = CurrentTabIndex;
                                            //(tabControl1.Items[CurrentTabIndex] as CloseableTabItem).CloseTab += new RoutedEventHandler(cti_CloseTab);
                                            //tabControl1.Items[CurrentTabIndex] = it;
                                            //tabControl1.SelectedIndex = CurrentTabIndex;


                                        }
                                        catch (Exception)
                                        {

                                        }
                                        bool isinLibraries = false;
                                        if (e.PendingLocation.Parent != null)
                                        {
                                            if (e.PendingLocation.Parent.ParsingName ==
                                                  KnownFolders.Libraries.ParsingName)
                                            {
                                                isinLibraries = true;
                                            }
                                            else
                                            {
                                                isinLibraries = false;
                                            }
                                        }

                                        btnCreateFolder.IsEnabled = e.PendingLocation.IsFileSystemObject ||
                                            (e.PendingLocation.ParsingName == KnownFolders.Libraries.ParsingName) ||
                                            (isinLibraries);

                                        if (e.PendingLocation.ParsingName == KnownFolders.Libraries.ParsingName)
                                        {
                                            btnCreateFolder.Header = FindResource("btnNewLibraryCP");  //"New Library";
                                            stNewFolder.Title = FindResource("btnNewLibraryCP").ToString();//"New Library";
                                            stNewFolder.Text = "Creates a new library in the current folder.";
                                            stNewFolder.Image = new BitmapImage(new Uri(@"/BetterExplorer;component/Images/newlib32.png", UriKind.Relative));
                                            btnCreateFolder.LargeIcon = @"..\Images\newlib32.png";
                                            btnCreateFolder.Icon = @"..\Images\newlib16.png";
                                        }
                                        else
                                        {
                                            btnCreateFolder.Header = FindResource("btnNewFolderCP");//"New Folder";
                                            stNewFolder.Title = FindResource("btnNewFolderCP").ToString(); //"New Folder";
                                            stNewFolder.Text = "Creates a new folder in the current folder";
                                            stNewFolder.Image = new BitmapImage(new Uri(@"/BetterExplorer;component/Images/folder_new32.png", UriKind.Relative));
                                            btnCreateFolder.LargeIcon = @"..\Images\folder_new32.png";
                                            btnCreateFolder.Icon = @"..\Images\folder_new16.png";
                                        }
                                        if (e.PendingLocation.IsFolder && !e.PendingLocation.IsDrive &&
                                            !e.PendingLocation.IsSearchFolder)
                                        {
                                            //ctgFolderTools.Visibility = Visibility.Visible;
                                        }

                                        if (e.PendingLocation.ParsingName.Contains(KnownFolders.Libraries.ParsingName) &&
                                            e.PendingLocation.ParsingName != KnownFolders.Libraries.ParsingName)
                                        {
                                            ctgLibraries.Visibility = System.Windows.Visibility.Visible;
                                            ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                            ctgImage.Visibility = System.Windows.Visibility.Collapsed;
                                            ctgArchive.Visibility = System.Windows.Visibility.Collapsed;
                                            ctgExe.Visibility = System.Windows.Visibility.Collapsed;
                                            inLibrary = true;

                                            try
                                            {
                                                ShellLibrary lib =
                                                    ShellLibrary.Load(e.PendingLocation.GetDisplayName(DisplayNameType.Default), false);
                                                IsFromSelectionOrNavigation = true;
                                                chkPinNav.IsChecked = lib.IsPinnedToNavigationPane;
                                                IsFromSelectionOrNavigation = false;
                                                foreach (ShellObject item in lib)
                                                {
                                                    MenuItem miItem = new MenuItem();
                                                    miItem.Header = item.GetDisplayName(DisplayNameType.Default);
                                                    miItem.Tag = item;
                                                    item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                                    item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                                    miItem.Icon = item.Thumbnail.BitmapSource;
                                                    miItem.GroupName = "GRDS1";
                                                    miItem.IsCheckable = true;
                                                    miItem.IsChecked = (item.ParsingName == lib.DefaultSaveFolder);
                                                    miItem.Click += new RoutedEventHandler(miItem_Click);
                                                    btnDefSave.Items.Add(miItem);
                                                }

                                                btnDefSave.IsEnabled = !(lib.Count == 0);
                                                lib.Close();
                                            }
                                            catch
                                            {

                                            }
                                        }
                                        else
                                        {
                                            if (!e.PendingLocation.ParsingName.ToLowerInvariant().EndsWith("library-ms"))
                                            {
                                                btnDefSave.Items.Clear();
                                                ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;
                                                inLibrary = false;
                                            }
                                            //MessageBox.Show("Not in Library");
                                        }
                                        if (e.PendingLocation.IsDrive)
                                        {
                                            ctgDrive.Visibility = System.Windows.Visibility.Visible;
                                            inDrive = true;
                                            //MessageBox.Show("In Drive");
                                        }
                                        else
                                        {
                                            ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                            inDrive = false;
                                            //MessageBox.Show("Not In Drive");
                                        }
                                        if (isinLibraries)
                                        {
                                            ctgFolderTools.Visibility = Visibility.Collapsed;
                                        }

                                    }
                                ));

                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
            catch (Exception exe)
            {
                ShellObject ne = e.PendingLocation;
                bool isinLibraries = false;
                bool itisLibraries = false;

                if (ne.Parent.ParsingName == KnownFolders.Libraries.ParsingName)
                {
                    isinLibraries = true;
                }
                else
                {
                    isinLibraries = false;
                }

                if (ne.ParsingName == KnownFolders.Libraries.ParsingName)
                {
                    itisLibraries = true;
                }
                else
                {
                    itisLibraries = false;
                }

                //if (MessageBox.Show("An error occurred while loading a folder. Please report this issue at http://bexplorer.codeplex.com/. \r\n\r\nHere is some information about the folder being loaded:\r\n\r\nName: " + ne.GetDisplayName(DisplayNameType.Default) + "\r\nLocation: " + ne.ParsingName +
                //    "\r\n\r\nFolder, Drive, or Library: " + GetYesNoFromBoolean(ne.IsFolder) + "\r\nDrive: " + GetYesNoFromBoolean(ne.IsDrive) + "\r\nNetwork Drive: " + GetYesNoFromBoolean(ne.IsNetDrive) + "\r\nRemovable: " + GetYesNoFromBoolean(ne.IsRemovable) +
                //    "\r\nSearch Folder: " + GetYesNoFromBoolean(ne.IsSearchFolder) + "\r\nShared: " + GetYesNoFromBoolean(ne.IsShared) + "\r\nShortcut: " + GetYesNoFromBoolean(ne.IsLink) + "\r\nLibrary: " + GetYesNoFromBoolean(isinLibraries) + "\r\nLibraries Folder: " + GetYesNoFromBoolean(itisLibraries) +
                //    "\r\n\r\n Would you like to see additional information? Click No to try continuing the program.", "Error Occurred on Completing Navigation", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
                //{
                //    MessageBox.Show("An error occurred while loading a folder. Please report this issue at http://bexplorer.codeplex.com/. \r\n\r\nHere is additional information about the error: \r\n\r\n" + exe.Message + "\r\n\r\n" + exe.ToString(), "Additional Error Data", MessageBoxButton.OK, MessageBoxImage.Error);
                //}
            }

            Explorer.ExplorerSetFocus();

            //if (Itmpop.Visibility == System.Windows.Visibility.Visible)
            //{
            //    Itmpop.Visibility = System.Windows.Visibility.Hidden;
            //}
        }
示例#23
0
    private void btnTest_Click(object sender, RoutedEventArgs e) {
      /*
		We could easily move this to another project and send that method			 
		*/

      //Following could be an example of what the most basic plugin could look like
      //We could also separate plugins so they could be enabled WHEN
      //Always OR Folder_Selected OR File_Selected 
      Action<string, string> pluginExampleActivateBasic = (string pluginPath, string currentFileOrFolder) => Process.Start(pluginPath, currentFileOrFolder);

      var Tab = new Fluent.RibbonTabItem() { Header = "Plugins", ToolTip = "Plugins" };
      TheRibbon.Tabs.Add(Tab);
      var groupBox1 = new RibbonGroupBox() { Header = "Test" };
      Tab.Groups.Add(groupBox1);
      var XML =
                                      @"<Shortcuts>
						<Shortcut Name='Test' Path = 'C:\Aaron'/>
					</Shortcuts>";

      var xDoc = XElement.Parse(XML);
      var shortcuts = xDoc.Elements("Shortcut");

      var dropDown = new SplitButton();
      groupBox1.Items.Add(dropDown);

      foreach (var Node in xDoc.Elements("Shortcut")) {
        var item = new MenuItem() { Header = Node.Attribute("Name").Value };
        item.Click += (x, y) => Process.Start(Node.Attribute("Path").Value);
        dropDown.Items.Add(item);
      }
    }
        //BackgroundWorker bwSelectionChanged = new BackgroundWorker();
        //'Selection change (when an item is selected in a folder)
        void ExplorerBrowserControl_SelectionChanged(object sender, EventArgs e)
        {


            if (IsAfterRename)
            {
                breadcrumbBarControl1.ExitEditMode();
                Explorer.Focus();
            }
            if (ctgSearch.Visibility == System.Windows.Visibility.Visible)
            {
                ctgSearch.Visibility = System.Windows.Visibility.Collapsed;
                TheRibbon.SelectedTabItem = HomeTab;
            }



            Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
            {

                if (!IsSelectionRized)
                {
                    try
                    {
                        // declare variables and constants
                        int SelItemsCount = Explorer.GetSelectedItemsCount();

                        string defapp = "";
                        bool IsChanged = (SelItemsCount > 0);
                        bool isFuncAvail;
                        bool isEditAvailable;
                        string ext;
                        IsSelectionRized = true;

                        // set up buttons
                        btnOpenWith.Items.Clear();
                        btnDefSave.Items.Clear();



                        if (SelItemsCount == 0)
                        {
                            // WHAT TO DO IF NO ITEMS ARE SELECTED
                            //MessageBox.Show("No Items Selected");

                            // hide status bar items
                            sbiSelItemsCount.Visibility = System.Windows.Visibility.Collapsed;
                            spSelItems.Visibility = System.Windows.Visibility.Collapsed;

                            // disable buttons
                            btnShare.IsEnabled = false;
                            btnCopy.IsEnabled = false;
                            btnCut.IsEnabled = false;
                            btnRename.IsEnabled = false;
                            btnDelete.IsEnabled = false;
                            btnCopyto.IsEnabled = false;
                            btnMoveto.IsEnabled = false;
                            btnSelNone.IsEnabled = false;
                            btnOpenWith.IsEnabled = false;
                            btnEdit.IsEnabled = false;
                            btnHistory.IsEnabled = false;
                            btnAdvancedSecurity.IsEnabled = false;


                            // hide contextual tabs
                            ctgArchive.Visibility = System.Windows.Visibility.Collapsed;
                            ctgExe.Visibility = System.Windows.Visibility.Collapsed;
                            ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;

                            ctgImage.Visibility = System.Windows.Visibility.Collapsed;

                            // if the current viewing location is a Drive, show Drive Tools.
                            if (inDrive == true)
                            {
                                ctgDrive.Visibility = System.Windows.Visibility.Visible;
                            }
                            else
                            {
                                ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                            }

                            // if the current viewing location is a Library, show Library Tools.
                            if (Explorer.NavigationLog.CurrentLocation.Parent != null)
                            {
                                if (Explorer.NavigationLog.CurrentLocation.Parent.ParsingName == KnownFolders.Libraries.ParsingName)
                                {
                                    ctgFolderTools.Visibility = Visibility.Collapsed;
                                }
                            }

                            if (Explorer.NavigationLog.CurrentLocation.ParsingName == KnownFolders.Libraries.ParsingName)
                            {
                                ctgFolderTools.Visibility = Visibility.Collapsed;
                            }

                            if (inLibrary == true)
                            {
                                ctgFolderTools.Visibility = Visibility.Collapsed;
                                ctgLibraries.Visibility = System.Windows.Visibility.Visible;
                                ShellLibrary lib =
                                    ShellLibrary.Load(Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default), false);
                                IsFromSelectionOrNavigation = true;
                                chkPinNav.IsChecked = lib.IsPinnedToNavigationPane;
                                IsFromSelectionOrNavigation = false;
                                foreach (ShellObject item in lib)
                                {
                                    MenuItem miItem = new MenuItem();
                                    miItem.Header = item.GetDisplayName(DisplayNameType.Default);
                                    miItem.Tag = item;
                                    item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                    item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                    miItem.Icon = item.Thumbnail.BitmapSource;
                                    miItem.GroupName = "GRDS1";
                                    miItem.Click += new RoutedEventHandler(miItem_Click);
                                    miItem.IsCheckable = true;
                                    miItem.IsChecked = (item.ParsingName == lib.DefaultSaveFolder);
                                    btnDefSave.Items.Add(miItem);
                                }

                                btnDefSave.IsEnabled = !(lib.Count == 0);
                                lib.Close();
                            }
                            else
                            {
                                if (!Explorer.NavigationLog.CurrentLocation.ParsingName.ToLowerInvariant().EndsWith("library-ms"))
                                {
                                    ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;
                                }

                            }
                        }
                        else
                        {
                            // WHAT TO DO IF ITEMS ARE SELECTED

                            // show status bar items
                            sbiSelItemsCount.Visibility = System.Windows.Visibility.Visible;
                            spSelItems.Visibility = System.Windows.Visibility.Visible;

                            // enable (most) buttons
                            btnCopy.IsEnabled = true;
                            btnCut.IsEnabled = true;
                            btnRename.IsEnabled = true;
                            btnCopyto.IsEnabled = true;
                            btnMoveto.IsEnabled = true;
                            btnSelNone.IsEnabled = true;
                            btnAdvancedSecurity.IsEnabled = false;
                            btnDefSave.Items.Clear();

                            if (SelItemsCount == 1)
                            {
                                // IF ONE ITEM IS SELECTED
                                ShellObject SelectedItem = Explorer.SelectedItems[0];
                                //MessageBox.Show("One Item Selected \r\n" + SelectedItem.ParsingName);

                                // set up status bar
                                sbiSelItemsCount.Content = "1 item selected";

                                // set variables

                                btnShare.IsEnabled = SelectedItem.IsFolder && SelectedItem.IsFileSystemObject;
                                btnAdvancedSecurity.IsEnabled = SelectedItem.IsFileSystemObject;
                                isFuncAvail = (SelectedItem.IsFileSystemObject &&
                                    (Explorer.NavigationLog.CurrentLocation.ParsingName != KnownFolders.Computer.ParsingName));
                                ext = System.IO.Path.GetExtension(SelectedItem.ParsingName);
                                RegistryKey rg = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" + ext + @"\OpenWithProgids");
                                if (rg != null)
                                {

                                    string filetype = rg.GetValueNames()[0];
                                    rg.Close();
                                    RegistryKey rgtype = Registry.ClassesRoot.OpenSubKey(filetype + @"\shell\edit\command");
                                    if (rgtype != null)
                                    {
                                        string editcommand = (string)rgtype.GetValue("");

                                        isEditAvailable = true;
                                        EditComm = editcommand.Replace("\"", "");
                                        rgtype.Close();
                                    }
                                    else
                                    {
                                        isEditAvailable = false;
                                    }
                                }
                                else
                                {
                                    isEditAvailable = false;
                                }

                                // set up Open With button
                                List<string> iiii = new List<string>();
                                if (isFuncAvail)
                                {

                                    string extension =
                                        System.IO.Path.GetExtension(SelectedItem.ParsingName);
                                    iiii = Explorer.RecommendedPrograms(extension);
                                    MenuItem mid = new MenuItem();
                                    defapp = WindowsAPI.GetAssoc(extension, WindowsAPI.AssocF.Verify,
                                                        WindowsAPI.AssocStr.Executable);
                                    if (defapp != "" && defapp != "\"%1\"" && extension != "")
                                    {

                                        string DefAppName = WindowsAPI.GetAssoc(extension, WindowsAPI.AssocF.Verify,
                                                                                                WindowsAPI.AssocStr.FriendlyAppName);
                                        try
                                        {
                                            ShellObject objd = ShellObject.FromParsingName(defapp);
                                            mid.Header = DefAppName;
                                            mid.Tag = defapp;
                                            mid.Click += new RoutedEventHandler(miow_Click);
                                            objd.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                            objd.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                            mid.Icon = objd.Thumbnail.BitmapSource;
                                            objd.Dispose();
                                            btnOpenWith.Items.Add(mid);
                                        }
                                        catch (Exception)
                                        {

                                        }
                                    }

                                    foreach (string item in iiii)
                                    {
                                        // we'll see if it works without checking for "firefox.exe"
                                        //if (item != "firefox.exe" && item != "CompressedFolder")
                                        if (item != "CompressedFolder")
                                        {
                                            MenuItem mi = new MenuItem();
                                            string deffappname;
                                            String ExePath = "";
                                            ExePath = WindowsAPI.GetAssoc(item, WindowsAPI.AssocF.Verify |
                                                WindowsAPI.AssocF.Open_ByExeName, WindowsAPI.AssocStr.Executable);
                                            deffappname = WindowsAPI.GetAssoc(item, WindowsAPI.AssocF.Verify |
                                                WindowsAPI.AssocF.Open_ByExeName, WindowsAPI.AssocStr.FriendlyAppName);
                                            if (!File.Exists(ExePath))
                                            {
                                                ExePath = WindowsAPI.GetAssoc(item, WindowsAPI.AssocF.Verify,
                                                     WindowsAPI.AssocStr.Executable);
                                            }

                                            string andeffappname = WindowsAPI.GetAssoc(item, WindowsAPI.AssocF.Verify,
                                                WindowsAPI.AssocStr.FriendlyAppName);

                                            if (deffappname == "")
                                            {
                                                deffappname = WindowsAPI.GetAssoc(item, WindowsAPI.AssocF.Verify,
                                                    WindowsAPI.AssocStr.FriendlyAppName);
                                            }

                                            if (andeffappname != "" && Char.IsLetterOrDigit(andeffappname, 1) && !Char.IsLetterOrDigit(deffappname, 1)
                                                                                            && (System.IO.Path.GetExtension(ExePath).ToLowerInvariant() == ".exe" ||
                                                                                                System.IO.Path.GetExtension(ExePath).ToLowerInvariant() == ".dll"))
                                            {
                                                deffappname = andeffappname;
                                            }


                                            try
                                            {
                                                ShellObject obj = ShellObject.FromParsingName(ExePath);
                                                mi.Header = deffappname;
                                                mi.Tag = ExePath;
                                                mi.Click += new RoutedEventHandler(miow_Click);
                                                obj.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                                obj.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                                mi.Icon = obj.Thumbnail.BitmapSource;
                                                obj.Dispose();
                                            }
                                            catch (Exception)
                                            {

                                            }

                                            btnOpenWith.Items.Add(mi);
                                        }
                                    }
                                }

                                // enable buttons
                                btnDelete.IsEnabled = (isFuncAvail || Explorer.NavigationLog.CurrentLocation.ParsingName ==
                                    KnownFolders.Libraries.ParsingName);
                                btnOpenWith.IsEnabled = (isFuncAvail &&
                                    System.IO.Path.GetExtension(SelectedItem.ParsingName) != ""
                                      && (iiii.Count > 0 || (defapp != "" && defapp != "\"%1\"")));

                                btnEdit.IsEnabled = isFuncAvail && isEditAvailable;
                                btnHistory.IsEnabled = true;

                                //set up contextual tabs

                                bool selisfolder = false;
                                bool selislib = false;

                                // Folder/Disk Tools
                                if (SelectedItem.IsFolder && SelectedItem.IsFileSystemObject)
                                {
                                    // Check for if Disk
                                    if (SelectedItem.IsDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Visible;
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                    else if (!SelectedItem.IsNetDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Visible;
                                        selisfolder = true;
                                    }
                                    else
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                            ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                }
                                else
                                {
                                    ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                    if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                }

                                // Library Tools
                                if (SelectedItem.ParsingName.Contains(KnownFolders.Libraries.ParsingName))
                                {
                                    ctgLibraries.Visibility = System.Windows.Visibility.Visible;
                                    selislib = true;
                                    ShellLibrary lib =
                                        ShellLibrary.Load(Explorer.SelectedItems[0].GetDisplayName(DisplayNameType.Default), false);
                                    IsFromSelectionOrNavigation = true;
                                    chkPinNav.IsChecked = lib.IsPinnedToNavigationPane;
                                    IsFromSelectionOrNavigation = false;
                                    foreach (ShellObject item in lib)
                                    {
                                        MenuItem miItem = new MenuItem();
                                        miItem.Header = item.GetDisplayName(DisplayNameType.Default);
                                        miItem.Tag = item;
                                        item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                        item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                        miItem.Icon = item.Thumbnail.BitmapSource;
                                        miItem.IsCheckable = true;
                                        miItem.Click += new RoutedEventHandler(miItem_Click);
                                        miItem.IsChecked = (item.ParsingName == lib.DefaultSaveFolder);
                                        btnDefSave.Items.Add(miItem);
                                    }

                                    btnDefSave.IsEnabled = !(lib.Count == 0);
                                    lib.Close();

                                }
                                else
                                {
                                    if (!Explorer.NavigationLog.CurrentLocation.ParsingName.ToLowerInvariant().EndsWith("library-ms"))
                                    {
                                        btnDefSave.Items.Clear();
                                        ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;
                                    }

                                }

                                //Application Tools
                                if ((System.IO.Path.GetExtension(SelectedItem.ParsingName).ToLowerInvariant() == ".exe" ||
                                    System.IO.Path.GetExtension(SelectedItem.ParsingName).ToLowerInvariant() == ".msi") &&
                                    !(SelectedItem.IsFolder))
                                {
                                    ctgExe.Visibility = System.Windows.Visibility.Visible;
                                    btnPin.IsChecked = WindowsAPI.IsPinnedToTaskbar(Explorer.SelectedItems[0].ParsingName);
                                    if (asApplication == true)
                                    {
                                        TheRibbon.SelectedTabItem = ctgExe.Items[0];
                                    }
                                }
                                else
                                {
                                    ctgExe.Visibility = System.Windows.Visibility.Collapsed;
                                }

                                // Archive Tools
                                if (Archives.Contains(System.IO.Path.GetExtension(SelectedItem.ParsingName).ToLowerInvariant()))
                                {
                                    ctgArchive.Visibility = System.Windows.Visibility.Visible;
                                    if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    selisfolder = false;
                                    txtExtractLocation.Text = new FileInfo(SelectedItem.ParsingName).DirectoryName;
                                    SelectedArchive = SelectedItem.ParsingName;
                                    if (System.IO.Path.GetExtension(SelectedItem.ParsingName).ToLowerInvariant().EndsWith(".zip"))
                                    {
                                        btnViewArchive.IsEnabled = true;
                                    }
                                    else
                                    {
                                        btnViewArchive.IsEnabled = false;
                                    }
                                    if (asArchive == true)
                                    {
                                        TheRibbon.SelectedTabItem = ctgArchive.Items[0];
                                    }
                                }
                                else
                                {
                                    ctgArchive.Visibility = System.Windows.Visibility.Collapsed;
                                }

                                // Image Tools
                                System.Drawing.Bitmap cvt;
                                if (//SelItemsCount > 0 &&
                                    Images.Contains(System.IO.Path.GetExtension(SelectedItem.ParsingName).ToLowerInvariant()))
                                {
                                    cvt = new Bitmap(SelectedItem.ParsingName);
                                    //imgdHeight.Text = cvt.Height.ToString();
                                    //imgdWidth.Text = cvt.Width.ToString();
                                    imgSizeDisplay.WidthData = cvt.Width.ToString();
                                    imgSizeDisplay.HeightData = cvt.Height.ToString();
                                    ctgImage.Visibility = System.Windows.Visibility.Visible;
                                    if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    if (asImage == true)
                                    {
                                        TheRibbon.SelectedTabItem = ctgImage.Items[0];
                                    }
                                    cvt.Dispose();
                                }
                                else
                                {
                                    ctgImage.Visibility = System.Windows.Visibility.Collapsed;
                                }
                                //LastItemSelected = SelectedItem.ParsingName;

                                // Folder/Disk Tools
                                if (Explorer.NavigationLog.CurrentLocation.IsFolder && Explorer.NavigationLog.CurrentLocation.IsFileSystemObject)
                                {
                                    // Check for if Disk
                                    if (Explorer.NavigationLog.CurrentLocation.IsDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Visible;
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                        if (asDrive == true)
                                        {
                                            //TheRibbon.SelectedTabItem = ctgDrive.Items[0];
                                        }
                                    }
                                    else if (!Explorer.NavigationLog.CurrentLocation.IsNetDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        //ctgFolderTools.Visibility = System.Windows.Visibility.Visible;
                                    }
                                    else
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                            ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                }
                                else
                                {
                                    if (!(Explorer.SelectedItems[0].IsDrive && !Explorer.SelectedItems[0].IsNetDrive))
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }

                                }

                                if (selisfolder == true && Explorer.SelectedItems[0].IsFolder)
                                {
                                    ctgFolderTools.Visibility = System.Windows.Visibility.Visible;
                                    if (asFolder == true)
                                    {
                                        TheRibbon.SelectedTabItem = ctgFolderTools.Items[0];
                                    }
                                }
                                else
                                {
                                    if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                }



                                if (selislib == true)
                                {
                                    ctgLibraries.Visibility = System.Windows.Visibility.Visible;
                                    if (asLibrary == true)
                                    {
                                        TheRibbon.SelectedTabItem = ctgLibraries.Items[0];
                                    }
                                }

                            }
                            else
                            {
                                // IF MULTIPLE ITEMS ARE SELECTED
                                //MessageBox.Show(SelItemsCount.ToString() + " items selected");

                                // set variables
                                isFuncAvail = true;
                                isEditAvailable = false;

                                // set up status bar
                                sbiSelItemsCount.Content = SelItemsCount.ToString() + " items selected";

                                // enable (or disable) buttons
                                btnDelete.IsEnabled = true;
                                btnShare.IsEnabled = false;
                                btnOpenWith.IsEnabled = false;
                                btnEdit.IsEnabled = false;
                                btnHistory.IsEnabled = false;

                                // hide contextual tabs
                                ctgImage.Visibility = System.Windows.Visibility.Collapsed;
                                ctgExe.Visibility = System.Windows.Visibility.Collapsed;
                                ctgArchive.Visibility = System.Windows.Visibility.Collapsed;
                                ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                    ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;

                                // Folder/Disk Tools
                                if (Explorer.NavigationLog.CurrentLocation.IsFolder && Explorer.NavigationLog.CurrentLocation.IsFileSystemObject)
                                {
                                    // Check for if Disk
                                    if (Explorer.NavigationLog.CurrentLocation.IsDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Visible;
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                    else if (!Explorer.NavigationLog.CurrentLocation.IsNetDrive)
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        //ctgFolderTools.Visibility = System.Windows.Visibility.Visible;
                                    }
                                    else
                                    {
                                        ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                        if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                            ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                }
                                else
                                {
                                    ctgDrive.Visibility = System.Windows.Visibility.Collapsed;
                                    if (!(Explorer.NavigationLog.CurrentLocation.IsFolder && !Explorer.NavigationLog.CurrentLocation.IsDrive &&
                                                !Explorer.NavigationLog.CurrentLocation.IsSearchFolder))
                                        ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                }

                                // if the current viewing location is a Library, show Library Tools.
                                if (inLibrary == true)
                                {
                                    ctgFolderTools.Visibility = System.Windows.Visibility.Collapsed;
                                    ctgLibraries.Visibility = System.Windows.Visibility.Visible;
                                    ShellLibrary lib =
                    ShellLibrary.Load(Explorer.NavigationLog.CurrentLocation.GetDisplayName(DisplayNameType.Default), false);
                                    IsFromSelectionOrNavigation = true;
                                    chkPinNav.IsChecked = lib.IsPinnedToNavigationPane;
                                    IsFromSelectionOrNavigation = false;
                                    foreach (ShellObject item in lib)
                                    {
                                        MenuItem miItem = new MenuItem();
                                        miItem.Header = item.GetDisplayName(DisplayNameType.Default);
                                        miItem.Tag = item.ParsingName;
                                        item.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                                        item.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                                        miItem.Icon = item.Thumbnail.BitmapSource;
                                        miItem.IsCheckable = true;
                                        miItem.IsChecked = (item.ParsingName == lib.DefaultSaveFolder);
                                        btnDefSave.Items.Add(miItem);
                                    }

                                    btnDefSave.IsEnabled = !(lib.Count == 0);
                                    lib.Close();
                                }
                                else
                                {
                                    if (!Explorer.NavigationLog.CurrentLocation.ParsingName.ToLowerInvariant().EndsWith("library-ms"))
                                    {
                                        btnDefSave.Items.Clear();
                                        ctgLibraries.Visibility = System.Windows.Visibility.Collapsed;
                                    }

                                }
                            }

                        }

                        // old code removed (if you want it, get an earlier version of this file)

                    }
                    catch (Exception)
                    {


                    }
                }
            }));
            IsSelectionRized = false;

            if (IsAfterRename)
                Explorer.ExplorerSetFocus();

        }
示例#25
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.fmMain = ((LEDX.MWin)(target));
     return;
     case 2:
     this.ribbon = ((Fluent.Ribbon)(target));
     
     #line 57 "..\..\MainWindow.xaml"
     this.ribbon.SelectedTabChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.Ribbon_SelectedTabChanged);
     
     #line default
     #line hidden
     return;
     case 3:
     this.btNewProj = ((Fluent.Button)(target));
     return;
     case 4:
     this.btOpenProj = ((Fluent.Button)(target));
     return;
     case 5:
     this.btSaveProj = ((Fluent.Button)(target));
     return;
     case 6:
     this.tbEdit = ((Fluent.RibbonTabItem)(target));
     return;
     case 7:
     this.btUndo = ((Fluent.SplitButton)(target));
     return;
     case 8:
     this.btPasteFram = ((Fluent.SplitButton)(target));
     return;
     case 9:
     this.rgbContrProp = ((Fluent.RibbonGroupBox)(target));
     return;
     case 10:
     this.spAddNew = ((Fluent.SplitButton)(target));
     return;
     case 11:
     this.btDel = ((Fluent.MenuItem)(target));
     return;
     case 12:
     this.tbConName = ((Fluent.TextBox)(target));
     return;
     case 13:
     this.tbConNumb = ((Fluent.Spinner)(target));
     return;
     case 14:
     this.tbConButt = ((Fluent.Spinner)(target));
     return;
     case 15:
     this.rgbFrameProp = ((Fluent.RibbonGroupBox)(target));
     return;
     case 16:
     this.spTime = ((Fluent.Spinner)(target));
     return;
     case 17:
     this.btCopyFram = ((Fluent.Button)(target));
     return;
     case 18:
     this.btCutFram = ((Fluent.Button)(target));
     return;
     case 19:
     this.btDelFram = ((Fluent.Button)(target));
     return;
     case 20:
     this.btToSample = ((Fluent.Button)(target));
     return;
     case 21:
     this.spbtFSet = ((Fluent.SplitButton)(target));
     
     #line 179 "..\..\MainWindow.xaml"
     this.spbtFSet.DropDownClosed += new System.EventHandler(this.SpbtFSet_DropDownClosed);
     
     #line default
     #line hidden
     return;
     case 22:
     this.rgbColorProp = ((Fluent.RibbonGroupBox)(target));
     return;
     case 23:
     this.btBegColor = ((Fluent.Button)(target));
     return;
     case 24:
     this.rctBegClolor = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 25:
     this.btCopyColor = ((Fluent.Button)(target));
     return;
     case 26:
     this.btGetColor = ((Fluent.Button)(target));
     return;
     case 27:
     this.btEndColor = ((Fluent.Button)(target));
     return;
     case 28:
     this.rctEndClolor = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 29:
     this.btCopy = ((Fluent.Button)(target));
     return;
     case 30:
     this.grSampl = ((Fluent.InRibbonGallery)(target));
     return;
     case 31:
     this.tbPalyer = ((Fluent.RibbonTabItem)(target));
     return;
     case 32:
     this.rgbPropLayer = ((Fluent.RibbonGroupBox)(target));
     return;
     case 33:
     this.btLayerDown = ((Fluent.Button)(target));
     return;
     case 34:
     this.btLayerTop = ((Fluent.Button)(target));
     return;
     case 35:
     this.btDelLay = ((Fluent.Button)(target));
     return;
     case 36:
     this.rgbPropPng = ((Fluent.RibbonGroupBox)(target));
     return;
     case 37:
     this.cbController = ((Fluent.ComboBox)(target));
     return;
     case 38:
     this.lgWidth = ((Fluent.TextBox)(target));
     return;
     case 39:
     this.lgHeight = ((Fluent.TextBox)(target));
     return;
     case 40:
     this.rgbPropText = ((Fluent.RibbonGroupBox)(target));
     return;
     case 41:
     this.lbtemTest = ((System.Windows.Controls.Label)(target));
     return;
     case 42:
     this.temTest = ((LEDX.Components.MultiLineTextEditor)(target));
     return;
     case 43:
     this.spTextSize = ((Fluent.Spinner)(target));
     return;
     case 44:
     this.cbFontFamaly = ((Fluent.ComboBox)(target));
     return;
     case 45:
     this.rctTextClolor = ((System.Windows.Shapes.Rectangle)(target));
     return;
     case 46:
     this.tbFlash = ((Fluent.RibbonTabItem)(target));
     return;
     case 47:
     this.lbPort = ((System.Windows.Controls.Label)(target));
     return;
     case 48:
     this.cbComName = ((Fluent.ComboBox)(target));
     return;
     case 49:
     this.lbSpeed = ((System.Windows.Controls.Label)(target));
     return;
     case 50:
     this.cbComRate = ((Fluent.ComboBox)(target));
     return;
     case 51:
     this.btRefrPorts = ((Fluent.Button)(target));
     return;
     case 52:
     this.tbSync = ((Fluent.ToggleButton)(target));
     return;
     case 53:
     this.tgbShowLog = ((Fluent.ToggleButton)(target));
     return;
     case 54:
     this.spProgress = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 55:
     this.uiScaleSlider = ((System.Windows.Controls.Slider)(target));
     
     #line 531 "..\..\MainWindow.xaml"
     this.uiScaleSlider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler<double>(this.uiScaleSlider_ValueChanged);
     
     #line default
     #line hidden
     return;
     case 56:
     this.uiMan = ((LEDX.Components.PlayScale)(target));
     return;
     case 57:
     this.svSearch = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 58:
     this.sldTime = ((LEDX.Components.TimeSlider)(target));
     
     #line 561 "..\..\MainWindow.xaml"
     this.sldTime.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler<double>(this.sld_ValueChanged);
     
     #line default
     #line hidden
     return;
     case 59:
     this.scroll = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 60:
     this.icContr = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 61:
     this.svTracks = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 62:
     this.icTrack = ((System.Windows.Controls.ItemsControl)(target));
     return;
     case 63:
     this.iCanv = ((LEDX.Components.IncRender)(target));
     
     #line 598 "..\..\MainWindow.xaml"
     this.iCanv.SelectionChanged += new System.EventHandler(this.iCanv_SelectionChanged);
     
     #line default
     #line hidden
     return;
     case 64:
     this.mainScroller = ((System.Windows.Controls.ScrollViewer)(target));
     
     #line 607 "..\..\MainWindow.xaml"
     this.mainScroller.ScrollChanged += new System.Windows.Controls.ScrollChangedEventHandler(this.mainScroller_ScrollChanged);
     
     #line default
     #line hidden
     return;
     case 65:
     this.svLog = ((System.Windows.Controls.ScrollViewer)(target));
     return;
     case 66:
     this.tbLog = ((System.Windows.Controls.TextBox)(target));
     return;
     }
     this._contentLoaded = true;
 }
        private void ConstructMoveToCopyToMenu()
        {
            btnMoveto.Items.Clear();
            btnCopyto.Items.Clear();
            MenuItem OtherLocationMove = new MenuItem();
            OtherLocationMove.Focusable = false;
            OtherLocationMove.Header = FindResource("miOtherDestCP");
            OtherLocationMove.Click += new RoutedEventHandler(btnmtOther_Click);
            MenuItem OtherLocationCopy = new MenuItem();
            OtherLocationCopy.Focusable = false;
            OtherLocationCopy.Header = FindResource("miOtherDestCP");
            OtherLocationCopy.Click += new RoutedEventHandler(btnctOther_Click);

            MenuItem mimDesktop = new MenuItem();
            ShellObject sod = (ShellObject)KnownFolders.Desktop;
            sod.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
            sod.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
            mimDesktop.Focusable = false;
            mimDesktop.Icon = sod.Thumbnail.BitmapSource;
            mimDesktop.Header = FindResource("btnctDesktopCP");
            mimDesktop.Click += new RoutedEventHandler(btnmtDesktop_Click);
            MenuItem micDesktop = new MenuItem();
            micDesktop.Focusable = false;
            micDesktop.Icon = sod.Thumbnail.BitmapSource;
            micDesktop.Header = FindResource("btnctDesktopCP");
            micDesktop.Click += new RoutedEventHandler(btnctDesktop_Click);
            sod.Dispose();

            MenuItem mimDocuments = new MenuItem();
            ShellObject sodc = (ShellObject)KnownFolders.Documents;
            sodc.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
            sodc.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
            mimDocuments.Focusable = false;
            mimDocuments.Icon = sodc.Thumbnail.BitmapSource;
            mimDocuments.Header = FindResource("btnctDocumentsCP");
            mimDocuments.Click += new RoutedEventHandler(btnmtDocuments_Click);
            MenuItem micDocuments = new MenuItem();
            micDocuments.Focusable = false;
            micDocuments.Icon = sodc.Thumbnail.BitmapSource;
            micDocuments.Header = FindResource("btnctDocumentsCP");
            micDocuments.Click += new RoutedEventHandler(btnctDocuments_Click);
            sodc.Dispose();

            MenuItem mimDownloads = new MenuItem();
            ShellObject sodd = (ShellObject)KnownFolders.Downloads;
            sodd.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
            sodd.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
            mimDownloads.Focusable = false;
            mimDownloads.Icon = sodd.Thumbnail.BitmapSource;
            mimDownloads.Header = FindResource("btnctDownloadsCP");
            mimDownloads.Click += new RoutedEventHandler(btnmtDounloads_Click);
            MenuItem micDownloads = new MenuItem();
            micDownloads.Focusable = false;
            micDownloads.Icon = sodd.Thumbnail.BitmapSource;
            micDownloads.Header = FindResource("btnctDownloadsCP");
            micDownloads.Click += new RoutedEventHandler(btnctDounloads_Click);
            sodd.Dispose();

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

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

            foreach (CloseableTabItem item in tabControl1.Items)
            {
                bool IsAdditem = true;
                foreach (object mii in btnCopyto.Items)
                {
                    if (mii is MenuItem)
                    {
                        if ((mii as MenuItem).Tag != null)
                        {
                            if (((mii as MenuItem).Tag as ShellObject) == item.Path)
                            {
                                IsAdditem = false;
                                break;
                            }
                        }
                    }
                }
                if (IsAdditem && item.Path.IsFileSystemObject)
                {
                    try
                    {
                        MenuItem mim = new MenuItem();
                        mim.Header = item.Path.GetDisplayName(DisplayNameType.Default);
                        mim.Focusable = false;
                        mim.Tag = item.Path;
                        ShellObject so = ShellObject.FromParsingName(item.Path.ParsingName);
                        so.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                        so.Thumbnail.CurrentSize = new System.Windows.Size(16, 16);
                        mim.Icon = so.Thumbnail.BitmapSource;
                        mim.Click += new RoutedEventHandler(mim_Click);
                        btnMoveto.Items.Add(mim);
                        MenuItem mic = new MenuItem();
                        mic.Focusable = false;
                        mic.Header = item.Path.GetDisplayName(DisplayNameType.Default);
                        mic.Tag = item.Path;
                        mic.Icon = so.Thumbnail.BitmapSource;
                        mic.Click += new RoutedEventHandler(mimc_Click);
                        btnCopyto.Items.Add(mic);
                        so.Dispose();
                    }
                    catch
                    {
                        //Do nothing if ShellObject is not available anymore and close the problematic item
                        CloseTab(item);
                    }
                }
            }
            btnMoveto.Items.Add(new Separator());
            btnMoveto.Items.Add(OtherLocationMove);
            btnCopyto.Items.Add(new Separator());
            btnCopyto.Items.Add(OtherLocationCopy);

        }
示例#27
0
 private void MenuItemClicked(object sender, RoutedEventArgs e)
 {
     Fluent.MenuItem pan = (Fluent.MenuItem)sender;
     OnNavigateRequested(new PathEventArgs(pan.Tag as ShellItem));
 }
        //'update view tab after changing view settings
        void ExplorerBrowserControl_ViewEnumerationComplete(object sender, EventArgs e)
        {

            //timerv.Interval = new TimeSpan(0, 0, 7);
            //timerv.IsEnabled = true;
            //timerv.Tick += new EventHandler(timerv_Tick);

            searchcicles++;
            //BeforeSearcCicles = searchcicles;
            Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)(() =>
                                {
                                    IsCalledFromViewEnum = true;
                                    zoomSlider.Value = Explorer.ContentOptions.ThumbnailSize;
                                    IsCalledFromViewEnum = false;
                                    IShellView isv = Explorer.GetShellView();

                                    Collumns[] AllAvailColls =
                                        Explorer.AvailableColumns(isv, true);
                                    btnMoreColls.Items.Clear();

                                    for (int j = 1; j < 10; j++)
                                    {
                                        try
                                        {
                                            MenuItem mic = new MenuItem();
                                            mic.Header = AllAvailColls[j].Name;
                                            mic.Tag = AllAvailColls[j].pkey;
                                            mic.Click += new RoutedEventHandler(mic_Click);
                                            mic.Focusable = false;
                                            mic.IsCheckable = true;
                                            foreach (Collumns col in Explorer.AvailableVisibleColumns)
                                            {
                                                if (col.Name == AllAvailColls[j].Name)
                                                {
                                                    mic.IsChecked = true;
                                                }
                                            }
                                            btnMoreColls.Items.Add(mic);
                                        }
                                        catch (Exception)
                                        {

                                        }


                                    }

                                    int ItemsCount = Explorer.GetItemsCount();


                                    if (ItemsCount == 0)
                                    {
                                        sbiItemsCount.Visibility = System.Windows.Visibility.Collapsed;
                                    }
                                    else
                                    {
                                        sbiItemsCount.Visibility = System.Windows.Visibility.Visible;
                                    }
                                    if (ItemsCount == 1)
                                    {
                                        sbiItemsCount.Content = "1 item";
                                    }
                                    else
                                    {
                                        sbiItemsCount.Content = ItemsCount.ToString() + " items";
                                    }


                                    Separator sep = new Separator();
                                    btnMoreColls.Items.Add(sep);
                                    MenuItem micm = new MenuItem();
                                    micm.Header = "More Columns";
                                    micm.Focusable = false;
                                    micm.Tag = AllAvailColls;
                                    micm.Click += new RoutedEventHandler(micm_Click);
                                    btnMoreColls.Items.Add(micm);

                                    btnSort.Items.Clear();
                                    btnGroup.Items.Clear();

                                    ExplorerBrowser.SORTCOLUMN sc;
                                    Explorer.GetSortColInfo(out sc);
                                    ExplorerBrowser.PROPERTYKEY pkg;
                                    bool GroupDir;
                                    Explorer.GetGroupColInfo(out pkg, out GroupDir);

                                    try
                                    {
                                        foreach (Collumns item in Explorer.AvailableVisibleColumns)
                                        {

                                            if (item != null)
                                            {
                                                MenuItem mi = new MenuItem();
                                                mi.Header = item.Name;
                                                mi.Tag = item;
                                                mi.GroupName = "GR2";
                                                mi.Focusable = false;
                                                mi.IsCheckable = true;
                                                if ((item.pkey.fmtid == sc.propkey.fmtid) && (item.pkey.pid == sc.propkey.pid))
                                                {
                                                    mi.IsChecked = true;
                                                }
                                                else
                                                {
                                                    mi.IsChecked = false;
                                                }
                                                mi.Click += new RoutedEventHandler(mi_Click);
                                                btnSort.Items.Add(mi);

                                                MenuItem mig = new MenuItem();
                                                mig.Header = item.Name;
                                                mig.Tag = item;
                                                mig.GroupName = "GR3";
                                                mig.Focusable = false;
                                                mig.IsCheckable = true;
                                                if ((item.pkey.fmtid == pkg.fmtid) && (item.pkey.pid == pkg.pid))
                                                {
                                                    mig.IsChecked = true;
                                                }
                                                else
                                                {
                                                    mig.IsChecked = false;
                                                }
                                                mig.Click += new RoutedEventHandler(mig_Click);
                                                btnGroup.Items.Add(mig);
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show("BetterExplorer had an issue loading the visible columns for the current view. You might not be able to sort or group items.", ex.ToString(), MessageBoxButton.OK, MessageBoxImage.Error); 
                                    }
                                    Separator sp = new Separator();
                                    sp.Focusable = false;
                                    btnSort.Items.Add(sp);
                                    misa = new MenuItem();
                                    misa.Click += new RoutedEventHandler(misa_Click);
                                    misa.Focusable = false;
                                    misa.Header = "Ascending";
                                    misa.IsCheckable = true;


                                    misa.GroupName = "GR1";

                                    misd = new MenuItem();
                                    misd.Header = "Descending";
                                    misd.IsCheckable = true;
                                    misd.Click += new RoutedEventHandler(misd_Click);
                                    misd.Focusable = false;
                                    misd.GroupName = "GR1";
                                    if (sc.direction == Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser.SORT.ASCENDING)
                                    {
                                        misa.IsChecked = true;
                                    }
                                    else
                                    {
                                        misd.IsChecked = true;
                                    }
                                    btnSort.Items.Add(misa);
                                    btnSort.Items.Add(misd);
                                    misng = new MenuItem();
                                    misng.Header = "(none)";
                                    misng.Focusable = false;
                                    misng.GroupName = "GR4";
                                    misng.Click += new RoutedEventHandler(misng_Click);
                                    btnGroup.Items.Add(misng);
                                    Separator spg = new Separator();
                                    btnGroup.Items.Add(spg);
                                    misag = new MenuItem();
                                    misag.Focusable = false;
                                    misag.Header = "Ascending";
                                    misag.IsCheckable = true;


                                    misag.GroupName = "GR4";

                                    misdg = new MenuItem();
                                    misdg.Focusable = false;
                                    misdg.Header = "Descending";
                                    misdg.IsCheckable = true;
                                    misdg.GroupName = "GR4";
                                    if (GroupDir)
                                    {
                                        misag.IsChecked = true;
                                    }
                                    else
                                    {
                                        misdg.IsChecked = true;
                                    }

                                    btnGroup.Items.Add(misag);
                                    btnGroup.Items.Add(misdg);

                                    int i = Explorer.ContentOptions.ThumbnailSize;
                                    if (Explorer.ContentOptions.ThumbnailSize == 256)
                                    {
                                        inRibbonGallery1.SelectedIndex = 0;

                                    }
                                    if (Explorer.ContentOptions.ThumbnailSize == 96)
                                    {
                                        inRibbonGallery1.SelectedIndex = 1;

                                    }
                                    if (Explorer.ContentOptions.ThumbnailSize == 64)
                                    {
                                        inRibbonGallery1.SelectedIndex = 2;

                                    }
                                    if (Explorer.ContentOptions.ThumbnailSize == 48 & Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.Icon)
                                    {
                                        inRibbonGallery1.SelectedIndex = 3;
                                        btnSbIcons.IsChecked = true;
                                    }
                                    else
                                    {
                                        btnSbIcons.IsChecked = false;
                                    }
                                    if (Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.List)
                                    {
                                        inRibbonGallery1.SelectedIndex = 4;
                                    }
                                    if (Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.Details)
                                    {
                                        inRibbonGallery1.SelectedIndex = 5;
                                        btnSbDetails.IsChecked = true;
                                    }
                                    else
                                    {
                                        btnSbDetails.IsChecked = false;
                                    }
                                    if (Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.Tile)
                                    {
                                        inRibbonGallery1.SelectedIndex = 6;
                                        btnSbTiles.IsChecked = true;
                                    }
                                    else
                                    {
                                        btnSbTiles.IsChecked = false;
                                    }
                                    if (Explorer.ContentOptions.ViewMode == ExplorerBrowserViewMode.Content)
                                    {
                                        inRibbonGallery1.SelectedIndex = 7;
                                    }
                                }
            ));
            Explorer.ExplorerSetFocus();
            GC.WaitForFullGCComplete();
            GC.Collect();
        }
示例#29
0
        // Remove from group
        static void RemoveFromGroup(string groupName, MenuItem button)
        {
            List<WeakReference> buttons = null;
            if (!groupedButtons.TryGetValue(groupName, out buttons)) return;

            buttons.RemoveAt(buttons.FindIndex(x => (x.IsAlive && ((MenuItem)x.Target) == button)));
        }