Ejemplo n.º 1
0
 private void HoveredToShowItemPath()
 {
     foreach (Control ctr in MainBody.Controls)
     {
         if (ctr is MyList list && list != appSettingBox)
         {
             list.HoveredItemChanged += (sender, e) =>
             {
                 if (!AppConfig.ShowFilePath)
                 {
                     return;
                 }
                 MyListItem item = list.HoveredItem;
                 foreach (string prop in new[] { "ItemFilePath", "RegPath", "GroupPath", "SelectedPath" })
                 {
                     string path = item.GetType().GetProperty(prop)?.GetValue(item, null)?.ToString();
                     if (!path.IsNullOrWhiteSpace())
                     {
                         StatusBar.Text = path; return;
                     }
                 }
                 StatusBar.Text = item.Text;
             };
         }
     }
 }
Ejemplo n.º 2
0
        private void ShowFilePath()
        {
            foreach (MyList list in new MyList[] { shellList, shellNewList, sendToList, openWithList, winXList, guidBlockedList, iEList })
            {
                list.HoveredItemChanged += (sender, e) =>
                {
                    MyListItem item = list.HoveredItem;
                    if (item is ITsiFilePathItem pathItem)
                    {
                        string path = pathItem.ItemFilePath;
                        if (path != null)
                        {
                            if (File.Exists(path) || path.StartsWith("shell:AppsFolder"))
                            {
                                StatusBar.Text = path; return;
                            }
                        }
                    }
                    if (item is GuidBlockedItem guidItem)
                    {
                        StatusBar.Text = guidItem.Value; return;
                    }
                    else if (item is ShellList.SelectItem selectItem)
                    {
                        switch (shellList.Scene)
                        {
                        case ShellList.Scenes.CustomRegPath:
                            StatusBar.Text = ShellList.CurrentCustomRegPath ?? item.Text; return;

                        case ShellList.Scenes.MenuAnalysis:
                            StatusBar.Text = ShellList.CurrentFileObjectPath ?? item.Text; return;
                        }
                    }
                    string regPath = item.GetType().GetProperty("RegPath")?.GetValue(item, null)?.ToString();
                    if (regPath != null)
                    {
                        StatusBar.Text = regPath;
                    }
                    else
                    {
                        StatusBar.Text = item.Text;
                    }
                };
            }
        }
 public void AddList(MyList myList)
 {
     myList.Owner = listBox;
     myList.HoveredItemChanged += (sender, e) =>
     {
         if (!AppConfig.ShowFilePath)
         {
             return;
         }
         MyListItem item = myList.HoveredItem;
         foreach (string prop in new[] { "ItemFilePath", "RegPath", "GroupPath" })
         {
             string path = item.GetType().GetProperty(prop)?.GetValue(item, null)?.ToString();
             if (!path.IsNullOrWhiteSpace())
             {
                 statusBar.Text = path; return;
             }
         }
         statusBar.Text = item.Text;
     };
 }
                private void SetItemRegPath(MyListItem item, string regPath)
                {
                    PropertyInfo pi = item.GetType().GetProperty("RegPath");

                    pi.SetValue(item, regPath, null);
                }
                private string GetItemRegPath(MyListItem item)
                {
                    PropertyInfo pi = item.GetType().GetProperty("RegPath");

                    return(pi.GetValue(item, null).ToString());
                }