コード例 #1
0
 private void UpdateView(ItemCollection itemCollection, IEnumerable<String> items)
 {
     itemCollection.Clear();
     foreach (var item in items)
     {
         var description = String.IsNullOrEmpty(item) ? "Unknown" : item;
         itemCollection.Add(description);
     }
 }
コード例 #2
0
        public void LoadFilesAndFolders(ItemCollection items)
        {
            items.Clear();
            String folderPath = "";
            //Get path to the current users files
            if (Session.GetInstance().UserID != -1)
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\" + Session.GetInstance().Email;
            else
                folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\sliceofpie\\";
            //Create a DirectoryInfo for that folder
            DirectoryInfo dir = new DirectoryInfo(folderPath);

            //Insert dictionaries and files from the folder as items in treeview
            GetInstance().InsertDirectoriesIntoDirectory(items, dir);
            GetInstance().InsertFilesIntoDirectory(items, dir);
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: sakya/wpfmpdclient
    private async Task<bool> PopulateFileSystemTree(ItemCollection items, string path)
    {
      items.Clear();
      MpdDirectoryListing list = null;
      try{
        list = await Task.Factory.StartNew(() => m_Mpc.LsInfo(path));
      }catch (Exception ex){
        ShowException(ex);
        return false;
      }

      foreach (string dir in list.DirectoryList) {
        TreeViewItem item = new TreeViewItem();
        item.Header = path != null ? dir.Remove(0, path.Length + 1) : dir;
        item.Tag = dir;
        if (await HasSubdirectories(item.Tag.ToString())) {
          item.Items.Add(null);
          item.Expanded += TreeItemExpanded;
        }
        items.Add(item);
      }
      return true;
    }
コード例 #4
0
ファイル: MenuManager.cs プロジェクト: xceza7/EDCB
        private void CtxmConvertToMenuItems(List<CtxmItemData> src, ItemCollection dest, CtxmCode code, bool shortcutTextforListType)
        {
            dest.Clear();

            src.ForEach(data =>
            {
                Control item;
                if (data.Command == EpgCmdsEx.Separator)
                {
                    item = new Separator();
                }
                else
                {
                    var menu = new MenuItem();
                    menu.Header = data.Header;
                    menu.Command = (EpgCmdsEx.IsDummyCmd(data.Command) ? null : data.Command);
                    if (menu.Command != null)
                    {
                        if ((shortcutTextforListType == true || (MC.WorkCmdOptions[data.Command].GesTrg & MenuCmds.GestureTrg.ToView) == MenuCmds.GestureTrg.ToView)
                            && (MC.WorkCmdOptions.ContainsKey(data.Command) == false || MC.WorkCmdOptions[data.Command].IsGestureEnabled == true)
                            && data.ID == 0)
                        {
                            menu.InputGestureText = MenuBinds.GetInputGestureText(data.Command);
                        }
                    }
                    menu.CommandParameter = new EpgCmdParam(typeof(MenuItem), code, data.ID);
                    CtxmConvertToMenuItems(data.Items, menu.Items, code, shortcutTextforListType);
                    item = menu;
                }
                item.Name = data.Name;
                item.Tag = data.Command;
                item.ToolTip = GetCtxmTooltip(data.Command);
                ToolTipService.SetShowOnDisabled(item, true);

                dest.Add(item);
            });
        }
コード例 #5
0
        /// <summary>
        /// Creates the tree view with the specified files and folders.
        /// </summary>
        /// <param name="items">The UI componenets the tree view shall consist of</param>
        /// <param name="foldersAndFiles">The files and folders to be displayed in the tree view</param>
        public void LoadFilesAndFolders(ItemCollection items, string[][][] foldersAndFiles)
        {
            items.Clear();
            string[][] folders = foldersAndFiles[0];
            string[][] files = foldersAndFiles[1];

            foreach (string[] folder in folders)
            {
                InsertFolder(folder, items);
            }
            foreach (string[] file in files)
            {
                InsertDocument(file, items);
            }
        }
コード例 #6
0
 private void PopulateFileSystemTree(ItemCollection items, string path)
 {
     items.Clear();
       MpdDirectoryListing list = m_Mpc.LsInfo(path);
       foreach (string dir in list.DirectoryList){
     TreeViewItem item = new TreeViewItem();
     item.Header = path != null ? dir.Remove(0, path.Length + 1) : dir;
     item.Tag = dir;
     if (HasSubdirectories(item.Tag.ToString())){
       item.Items.Add(null);
       item.Expanded += TreeItemExpanded;
     }
     items.Add(item);
       }
 }
コード例 #7
0
        /// <summary>
        /// Program mi při této metodě zhavaroval na PC kde nebylo VS, proto jsem to nemohl ladit ale patrně to bylo proto že bylo asi 4 stejně pojmenované projekty a program se pokusil odstranit projekt podle objektu na jiný projekt - ani nestihl odstranit všechny
        /// Prochází projekty v A1(měli by to být všechny projetky aktuálně zobrazené v ListBoxu) a vypíše odstraněné projekty klasicky v ListBoxu
        /// </summary>
        /// <param name="objectCollection"></param>
        private void DeleteDuplicateProjects(ItemCollection objectCollection)
        {
            List<SolutionFolder> vr = new List<SolutionFolder>();
            Dictionary<SolutionFolder, string> g = new Dictionary<SolutionFolder, string>();
            foreach (object var in objectCollection)
            {
                g.Add(var as SolutionFolder, System.IO.Path.GetFileName(var.ToString()));
            }

            foreach (object var in objectCollection)
            {
                if (ContainsValueTwoTimes(g, System.IO.Path.GetFileName(var.ToString())))
                {
                    //-Zjistim si dalsi duplikatni polozku
                    SolutionFolder sf = (var as SolutionFolder);
                    string fullPath = sf.fullPathFolder;
                    SolutionFolder dex = FindIndexOfValue(g, System.IO.Path.GetFileName(fullPath), sf);

                    SolutionFolder s = ((SolutionFolder)var);
                    SolutionFolder n = dex;

                    Directory.Delete(dex.fullPathFolder, true);

                    vr.Add(s);
                    vr.Add(n);
                }
            }
            objectCollection.Clear();
            var ds = vr.ToArray();
            foreach (var item in ds)
            {
                //lbResults.Items.Add(item);
                AddToLbResult(item);
            }
        }