コード例 #1
0
ファイル: FavoritesCommandTarget.cs プロジェクト: rsdn/janus
		public void ExecuteRenameFolder(ICommandContext context)
		{
			var favFormSvc = context.GetRequiredService<IFavoritesDummyFormService>();
			var activeFolder = (FavoritesFolder)favFormSvc.SelectedEntries.Single();
			using (var pb = new FavoritesFolderForm(activeFolder.Name, activeFolder.Comment))
				if (pb.ShowDialog(
						context.
							GetRequiredService<IUIShell>().
							GetMainWindowParent()) == DialogResult.OK)
				{
					activeFolder.Name = pb.FolderName;
					activeFolder.Comment = pb.FolderComment;
					activeFolder.Update();
					favFormSvc.Refresh();
				}
		}
コード例 #2
0
        public void ExecuteRenameFolder(ICommandContext context)
        {
            var favFormSvc   = context.GetRequiredService <IFavoritesDummyFormService>();
            var activeFolder = (FavoritesFolder)favFormSvc.SelectedEntries.Single();

            using (var pb = new FavoritesFolderForm(activeFolder.Name, activeFolder.Comment))
                if (pb.ShowDialog(
                        context.
                        GetRequiredService <IUIShell>().
                        GetMainWindowParent()) == DialogResult.OK)
                {
                    activeFolder.Name    = pb.FolderName;
                    activeFolder.Comment = pb.FolderComment;
                    activeFolder.Update();
                    favFormSvc.Refresh();
                }
        }
コード例 #3
0
 public void ExecuteCreateFolder(ICommandContext context)
 {
     using (var pb = new FavoritesFolderForm(string.Empty, string.Empty, true))
         if (pb.ShowDialog(
                 context
                 .GetRequiredService <IUIShell>()
                 .GetMainWindowParent()) == DialogResult.OK)
         {
             var favFormSvc = context.GetRequiredService <IFavoritesDummyFormService>();
             _favManager.AddFolder(
                 pb.FolderName,
                 pb.FolderComment,
                 favFormSvc.SelectedEntries.Any() && !pb.CreateAsRoot
                                                 ? (FavoritesFolder)favFormSvc.SelectedEntries.Single()
                                                 : _favManager.RootFolder);
             favFormSvc.Refresh();
         }
 }
コード例 #4
0
 public void ExecuteCreateFolder(ICommandContext context)
 {
     using (var pb = new FavoritesFolderForm(string.Empty, string.Empty, true))
         if (pb.ShowDialog(
                 context
                     .GetRequiredService<IUIShell>()
                     .GetMainWindowParent()) == DialogResult.OK)
         {
             var favFormSvc = context.GetRequiredService<IFavoritesDummyFormService>();
             _favManager.AddFolder(
                 pb.FolderName,
                 pb.FolderComment,
                 favFormSvc.SelectedEntries.Any() && !pb.CreateAsRoot
                     ? (FavoritesFolder)favFormSvc.SelectedEntries.Single()
                     : _favManager.RootFolder);
             favFormSvc.Refresh();
         }
 }
コード例 #5
0
        private void CreateFolderButtonClick(object sender, EventArgs e)
        {
            using (var pb = new FavoritesFolderForm(string.Empty, string.Empty, true))
                if (pb.ShowDialog(this) == DialogResult.OK)
                {
                    var activeFolder = _folderView.ActiveNode as FavoritesFolder;
                    if (activeFolder == null || pb.CreateAsRoot)
                        activeFolder = _favManager.RootFolder;

                    // TODO: Действия в AddFolder и Reload, приводят к тому,
                    // что добавление первой папки вызывает искючение при установке свойства Nodes дерева.
                    _favManager.AddFolder(pb.FolderName, pb.FolderComment, activeFolder);
                    _favManager.Reload();

                    var folders = _favManager.RootFolder;
                    folders.ShowLinks = false;

                    _folderView.VirtualListSize = folders.Count;
                    _folderView.Nodes = folders;
                }
        }
コード例 #6
0
        private void CreateFolderButtonClick(object sender, EventArgs e)
        {
            using (var pb = new FavoritesFolderForm(string.Empty, string.Empty, true))
                if (pb.ShowDialog(this) == DialogResult.OK)
                {
                    var activeFolder = _folderView.ActiveNode as FavoritesFolder;
                    if (activeFolder == null || pb.CreateAsRoot)
                    {
                        activeFolder = _favManager.RootFolder;
                    }

                    // TODO: Действия в AddFolder и Reload, приводят к тому,
                    // что добавление первой папки вызывает искючение при установке свойства Nodes дерева.
                    _favManager.AddFolder(pb.FolderName, pb.FolderComment, activeFolder);
                    _favManager.Reload();

                    var folders = _favManager.RootFolder;
                    folders.ShowLinks = false;

                    _folderView.VirtualListSize = folders.Count;
                    _folderView.Nodes           = folders;
                }
        }