Пример #1
0
 public void Execute(IActionContext context)
 {
     if (context.SelectedResources.Count == 1 && context.SelectedResources[0].Type != "Folder")
     {
         AddFavoriteForm.EditFavorite(context.SelectedResources[0]);
     }
     else
     {
         FavoritesPropertiesForm.EditFavoritesProperties(context.SelectedResources);
     }
 }
Пример #2
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     FavoritesTools.IActionUpdateWeblinksOrFolders(
         context, ref presentation, FavoritesTools.ActionType.Edit);
     if (presentation.Visible &&
         context.SelectedResources.Count == 1 && context.SelectedResources[0].Type == "Folder")
     {
         IResourceList recursiveFavorites = Core.ResourceStore.EmptyResourceList;
         FavoritesPropertiesForm.RecursivelyUpdateResourceList(
             ref recursiveFavorites, context.SelectedResources[0], true);
         presentation.Visible = recursiveFavorites.Count > 0;
     }
 }
Пример #3
0
        public static void EditFavoritesProperties(IResourceList selectedResources)
        {
            FavoritesPropertiesForm theForm = new FavoritesPropertiesForm();

            selectedResources.Sort("ID");

            content = Core.ResourceStore.EmptyResourceList;
            foreach (IResource res in selectedResources)
            {
                RecursivelyUpdateResourceList(ref content, res, false);
            }
            foreach (IResource page in content)
            {
                theForm._favoritesListView.JetListView.Nodes.Add(page);
            }

            // commonFreq is calculated as common updating frequency for all
            // weblinks in the list. it is set not to zero only if it is
            // equal for all resources in the list
            int commonFreq = 0;

            for (int i = 0; i < content.Count; ++i)
            {
                IResource webLink = content[i];
                if (webLink.Type != "Weblink" && webLink.Type != "Folder")
                {
                    webLink = webLink.GetLinkProp("Source");
                }
                int freq = webLink.GetIntProp(FavoritesPlugin._propUpdateFreq);
                if (commonFreq == 0)
                {
                    commonFreq = freq;
                }
                else if (commonFreq != freq)
                {
                    commonFreq = -1;
                    break;
                }
            }
            commonFreq         /= 3600;
            theForm._commonFreq = commonFreq;
            if (commonFreq <= 0)
            {
                theForm._fakeTextBox.Visible = true;
            }
            else
            {
                if (commonFreq % 24 == 0)
                {
                    commonFreq /= 24;
                    theForm._unitBox.SelectedIndex = 1;
                }
                if (commonFreq % 7 == 0)
                {
                    commonFreq /= 7;
                    theForm._unitBox.SelectedIndex = 2;
                }
                theForm._hoursBox.Value         = commonFreq;
                theForm._updateCheckBox.Checked = true;
            }
            theForm.ShowDialog(Core.MainWindow);
        }