Exemplo n.º 1
0
        /// <summary>
        /// Shows the hotkeys for the specified category in the dialog and, if the user
        /// accepts the edit, saves the hotkeys in the properties of the category.
        /// </summary>
        /// <param name="resource"></param>
        /// <returns></returns>
        public bool ShowAssignHotkeysDialog(IResource resource)
        {
            _lblCategoryHotkeys.Text = "Hotkeys for category '" + resource.DisplayName + "':";
            _edtHotkeyAssign.Text    = resource.GetPropText(PropTypes.HotkeyAssign);
            _edtHotkeyRemove.Text    = resource.GetPropText(PropTypes.HotkeyRemove);
            if (ShowDialog() == DialogResult.OK)
            {
                ResourceProxy proxy = new ResourceProxy(resource);
                proxy.BeginUpdate();
                if (_edtHotkeyAssign.Text.Length > 0)
                {
                    proxy.SetProp(PropTypes.HotkeyAssign, _edtHotkeyAssign.Text);
                }
                else
                {
                    proxy.DeleteProp(PropTypes.HotkeyAssign);
                }

                if (_edtHotkeyRemove.Text.Length > 0)
                {
                    proxy.SetProp(PropTypes.HotkeyRemove, _edtHotkeyRemove.Text);
                }
                else
                {
                    proxy.DeleteProp(PropTypes.HotkeyRemove);
                }
                proxy.EndUpdate();
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public override void MouseClicked(IResource res, Point pt)
        {
            if (res.GetLinksTo(null, TasksPlugin._linkSuperTask).Count == 0)
            {
                int           newStatus = 0;
                ResourceProxy proxy     = new ResourceProxy(res);
                proxy.BeginUpdate();

                switch (res.GetIntProp(TasksPlugin._propStatus))
                {
                case 0: newStatus = 1; break;

                case 1: newStatus = 2; break;

                case 2: newStatus = 0; break;

                case 3: newStatus = 1; break;

                case 4: newStatus = 1; break;
                }

                proxy.SetProp(TasksPlugin._propStatus, newStatus);
                if (newStatus == 2)
                {
                    proxy.SetProp(TasksPlugin._propCompletedDate, DateTime.Now);
                }
                else
                {
                    proxy.DeleteProp(TasksPlugin._propCompletedDate);
                }

                proxy.EndUpdate();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Submits the blog posting to blog server using the extension that is controlled by this instance of composer.
        /// </summary>
        public override void Save()
        {
            _htmled.Focus();
            string oldSubject = _item.GetPropText(Core.Props.Subject);
            string oldBody    = _item.GetPropText(Core.Props.LongBody);

            ResourceProxy proxy = new ResourceProxy(_item);

            try
            {
                proxy.BeginUpdate();
                if (!String.IsNullOrEmpty(_txtTitle.Text))
                {
                    proxy.SetProp(Core.Props.Subject, _txtTitle.Text);
                }
                proxy.SetProp(Core.Props.Date, DateTime.Now);
                proxy.SetProp(Core.Props.LongBodyIsHTML, true);
                IResource wsp = Core.WorkspaceManager.ActiveWorkspace;
                if (wsp != null)
                {
                    proxy.SetProp("WorkspaceVisible", wsp);
                }
                _htmled.Focus();
                proxy.SetProp(Core.Props.LongBody, _htmled.ManagedHtmlDocument.Body.InnerHtml);
            }
            finally
            {
                proxy.EndUpdate();
            }
            if (oldSubject != _item.GetPropText(Core.Props.Subject) ||
                oldBody != _item.GetPropText(Core.Props.LongBody))
            {
                Core.TextIndexManager.QueryIndexing(_item.Id);
            }
        }
Exemplo n.º 4
0
        public void  Exec(IResource res, IActionParameterStore actionStore)
        {
            IResourceList categories = actionStore.ParametersAsResList();
            IResourceList authors    = res.GetLinksOfType(null, Core.ContactManager.Props.LinkFrom);

            foreach (IResource author in authors)
            {
                IResourceType type = Core.ResourceStore.ResourceTypes[author.TypeId];

                //  Do not assign categories for resource types which are
                //  internal in the sence - they are not showable in the
                //  traditional ResourceListView pane. Thus, user can not
                //  benefit from setting a category to these internal types.

                if (!type.HasFlag(ResourceTypeFlags.Internal))
                {
                    ResourceProxy proxy = new ResourceProxy(author);
                    proxy.BeginUpdate();
                    foreach (IResource category in categories)
                    {
                        proxy.AddLink("Category", category);
                    }

                    proxy.EndUpdate();
                }
            }
        }
Exemplo n.º 5
0
        public void LinkToResourceRoot(IResource res, int index)
        {
            // First, set the user-sort-order, if appropriate, so that there were no jumping of the item after it's added
            if (index == int.MinValue)
            {
                new UserResourceOrder(res, JobPriority.Immediate).Insert(0, new int[] { res.OriginalId }, false, null);                 // To the beginning
            }
            else if (index == int.MaxValue)
            {
                new UserResourceOrder(res, JobPriority.Immediate).Insert(0, new int[] { res.OriginalId }, true, null);                  // To the end
            }
            else if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "The index must be a non-negative integer value, int.MinValue, or int.MaxValue.");
            }

            // Insert the resource
            IResource rootResource = GetRootForType(_resTreeRoot);

            if (res.GetLinkProp(Core.Props.Parent) != rootResource || res.GetIntProp("RootSortOrder") != index)
            {
                ResourceProxy proxy = new ResourceProxy(res);
                proxy.BeginUpdate();
                if (rootResource != null)
                {
                    proxy.AddLink(Core.Props.Parent, rootResource);
                }
                proxy.SetProp("RootSortOrder", index);
                proxy.EndUpdate();
            }
        }
Exemplo n.º 6
0
        private IResource RegisterDocumentSection(string sectionName, string description, string shortName)
        {
            int       sectionNum;
            IResource section = Core.ResourceStore.FindUniqueResource(DocumentSectionResource.DocSectionResName, Core.Props.Name, sectionName);

            if (section == null)
            {
                sectionNum = Core.ResourceStore.GetAllResources(DocumentSectionResource.DocSectionResName).Count;
                ResourceProxy proxy = ResourceProxy.BeginNewResource(DocumentSectionResource.DocSectionResName);
                proxy.BeginUpdate();
                proxy.SetProp("Name", sectionName);
                proxy.SetProp("SectionOrder", sectionNum);

                if (String.IsNullOrEmpty(description))
                {
                    proxy.SetProp("SectionHelpDescription", description);
                }
                if (String.IsNullOrEmpty(shortName))
                {
                    proxy.SetProp("SectionShortName", shortName);
                }

                proxy.EndUpdate();
                section = proxy.Resource;
            }
            else
            {
                sectionNum = section.GetIntProp("SectionOrder");
            }

            _sectionsMapping[sectionName] = sectionNum;

            return(section);
        }
Exemplo n.º 7
0
        public void  CloneFormatting(IResource source, IResource dest)
        {
            #region Preconditions
            if (dest.Type != FilterManagerProps.ViewCompositeResName)
            {
                throw new InvalidOperationException("FormattingRuleManager -- input resource is not a Formatting View");
            }
            #endregion Preconditions

            ResourceProxy proxy = new ResourceProxy(dest);
            proxy.BeginUpdate();
            proxy.SetProp("IsFormattingFilter", true);
            if (source.HasProp("IsBold"))
            {
                proxy.SetProp("IsBold", true);
            }
            if (source.HasProp("IsItalic"))
            {
                proxy.SetProp("IsItalic", true);
            }
            if (source.HasProp("IsUnderline"))
            {
                proxy.SetProp("IsUnderline", true);
            }
            if (source.HasProp("IsStrikeout"))
            {
                proxy.SetProp("IsStrikeout", true);
            }

            proxy.SetProp("ForeColor", source.GetStringProp("ForeColor"));
            proxy.SetProp("BackColor", source.GetStringProp("BackColor"));
            proxy.EndUpdate();
        }
Exemplo n.º 8
0
        private void ExcludeFiles(IResource folder)
        {
            try
            {
                ResourceProxy proxy = new ResourceProxy(folder);
                proxy.BeginUpdate();
                proxy.DeleteProp(_ftm.propLastModified);
                proxy.SetProp(FileProxy._propFileType, "Folder");
                proxy.EndUpdateAsync();

                string directory = folder.GetPropText(FileProxy._propDirectory);

                foreach (IResource child in folder.GetLinksTo(null, FileProxy._propParentFolder).ValidResources)
                {
                    if (child.Type != FileProxy._folderResourceType)
                    {
                        if (child.GetPropText(FileProxy._propDirectory) != directory)
                        {
                            new ResourceProxy(child).SetProp(FileProxy._propDirectory, directory);
                        }
                        // do not delete permanent resource linked with any other resource, not only parent folder
                        if (child.GetLinkTypeIds().Length == 1)
                        {
                            DeleteResource(child);
                        }
                    }
                }
                FileProxy.UpdateFoldersTreePane(folder);
            }
            catch (InvalidResourceIdException) {}
            catch (ResourceDeletedException) {}
        }
Exemplo n.º 9
0
        private void UpdateAnnotation()
        {
            _tracer.Trace("prepare UpdateAnnotation");
            IResourceList list = Core.ResourceStore.FindResourcesWithProp(STR.Email, PROP.MessageFlag);

            foreach (IResource resource in list.ValidResources)
            {
                ResourceProxy mail = new ResourceProxy(resource);
                mail.BeginUpdate();
                string messageFlag = resource.GetStringProp(PROP.MessageFlag);
                string annotation  = resource.GetStringProp(Core.Props.Annotation);
                if (annotation != messageFlag)
                {
                    if (annotation == null || annotation.Length == 0)
                    {
                        mail.SetProp(Core.Props.Annotation, messageFlag);
                    }
                    else
                    {
                        AnnotationMailChangeWatcher.ExportAnnotation(resource);
                    }
                }
                mail.DeleteProp(PROP.MessageFlag);
                mail.EndUpdate();
            }
        }
Exemplo n.º 10
0
 private void DiscoverDone()
 {
     if (_rssDiscover.Results.Count > 0)
     {
         if (_rssDiscover.Results.Count == 1)
         {
             IResource existingFeed = RSSPlugin.GetExistingFeed(_rssDiscover.Results[0].URL);
             if (existingFeed != null)
             {
                 _feedAddressPane.ErrorMessage = "You are already subscribed to that feed.";
                 _feedAddressPane.SetExistingFeedLink(existingFeed);
             }
             else
             {
                 _newFeedProxy.BeginUpdate();
                 _newFeedProxy.SetProp(Core.Props.Name, _rssDiscover.Results[0].Name);
                 _newFeedProxy.SetProp(Props.URL, _rssDiscover.Results[0].URL);
                 _newFeedProxy.EndUpdate();
                 _feedsToSubscribe = new ResourceProxy[] { _newFeedProxy };
                 ShowTitleGroupPage(OnBackToFirstPage);
             }
         }
         else
         {
             ShowMultipleResultsPage();
         }
     }
     else
     {
         ShowErrorInformation("Could't find a feed for the selected site", string.Empty);
     }
 }
Exemplo n.º 11
0
        protected override void Ready( )
        {
            ResourceProxy proxy = new ResourceProxy(_resource);

            proxy.BeginUpdate();
            if (!Successfull)
            {
                proxy.SetProp(Props.EnclosureDownloadingState, DownloadState.Failed);
                string lastException = null;
                if (LastException != null)
                {
                    lastException = LastException.Message;
                }
                proxy.SetProp(Props.EnclosureFailureReason, lastException);
                proxy.DeleteProp(Props.EnclosureTempFile);
                ShowDesktopAlert(DownloadState.Failed, "Downloading Failed", _resource.DisplayName, lastException);
            }
            else
            {
                proxy.SetProp(Props.EnclosureDownloadingState, DownloadState.Completed);
                ShowDesktopAlert(DownloadState.Completed, "Downloading Completed", _resource.DisplayName, null);
            }
            proxy.EndUpdate();
            _queued = false;
            EnclosureDownloadManager.DownloadNextEnclosure();
        }
Exemplo n.º 12
0
        public DialogResult EditRepository(IWin32Window ownerWindow, IResource repository)
        {
            _repository             = repository;
            _edtRepositoryName.Text = repository.GetStringProp(Core.Props.Name);
            _edtServerPort.Text     = repository.GetProp(Props.P4ServerPort);
            _edtClient.Text         = repository.GetProp(Props.P4Client);
            _edtUserName.Text       = repository.GetProp(Props.UserName);
            _edtPassword.Text       = repository.GetProp(Props.Password);
            _edtIgnoreClients.Text  = repository.GetProp(Props.P4IgnoreChanges);
            _edtPathsToWatch.Lines  = repository.GetProp(Props.PathsToWatch).Split(';');
            _edtP4WebPath.Text      = repository.GetProp(Props.P4WebUrl);
            DialogResult dr = ShowDialog(ownerWindow);

            if (dr == DialogResult.OK)
            {
                ResourceProxy proxy = new ResourceProxy(repository);
                proxy.BeginUpdate();
                proxy.SetProp(Core.Props.Name, _edtRepositoryName.Text);
                proxy.SetProp(Props.P4ServerPort, _edtServerPort.Text);
                proxy.SetProp(Props.P4Client, _edtClient.Text);
                proxy.SetProp(Props.UserName, _edtUserName.Text);
                proxy.SetProp(Props.Password, _edtPassword.Text);
                proxy.SetProp(Props.P4IgnoreChanges, _edtIgnoreClients.Text);
                proxy.SetProp(Props.PathsToWatch, String.Join(";", _edtPathsToWatch.Lines));
                proxy.SetProp(Props.P4WebUrl, _edtP4WebPath.Text);
                proxy.EndUpdate();
            }
            return(dr);
        }
Exemplo n.º 13
0
        public override void Execute(IActionContext context)
        {
            IResource     view    = context.SelectedResources [0];
            string        newName = view.GetStringProp(Core.Props.Name).Substring(16); // strip "Search results: "
            IResourceList views   = Core.ResourceStore.FindResources(FilterManagerProps.ViewResName, Core.Props.Name, newName);

            if (views.Count > 0)
            {
                string baseName = newName;
                for (int i = 1;; i++)
                {
                    newName = baseName + "(" + i + ")";
                    views   = Core.ResourceStore.FindResources(FilterManagerProps.ViewResName, Core.Props.Name, newName);
                    if (views.Count == 0)
                    {
                        break;
                    }
                }
            }

            ResourceProxy proxy = new ResourceProxy(view);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Name, newName);
            proxy.SetProp("DeepName", newName);
            proxy.DeleteProp(Core.Props.ShowDeletedItems);
            if (view.HasProp(Core.Props.ContentType) || view.HasProp("ContentLinks"))
            {
                proxy.DeleteProp("ShowInAllTabs");
            }
            proxy.EndUpdate();

            Core.LeftSidebar.DefaultViewPane.EditResourceLabel(view);
        }
Exemplo n.º 14
0
        private static void SetLinkToParent(IResource newView, IResource parentRes)
        {
            ResourceProxy proxy = new ResourceProxy(newView);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Parent, parentRes);
            proxy.EndUpdate();
        }
Exemplo n.º 15
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("IsUnread", true);
            proxy.EndUpdate();
        }
Exemplo n.º 16
0
        public void SaveProtocolSettings(IResource resource, string friendlyName, bool defaultProtocol)
        {
            CheckRegistration();
            ResourceProxy proxy = new ResourceProxy(resource);

            proxy.BeginUpdate();
            SaveProtocolSettings(proxy, friendlyName, defaultProtocol ? Default.Yes : Default.No);
        }
Exemplo n.º 17
0
        public void  Exec(IResource res, IActionParameterStore actionStore)
        {
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("Importance", 1);
            proxy.EndUpdate();
        }
Exemplo n.º 18
0
        public static void Do(DateTime at, IResource feedItem)
        {
            string enclosureUrl = feedItem.GetPropText(Props.EnclosureURL).Trim();

            if (enclosureUrl.Length == 0)
            {
                return;
            }
            IResource feed      = feedItem.GetLinkProp(-Props.RSSItem);
            string    directory = FindDownloadDirectory(feedItem, feed);

            try
            {
                Directory.CreateDirectory(directory);
                string     destFullPath  = null;
                FileStream file          = null;
                int        startPosition = 0;
                if (feedItem.GetIntProp(Props.EnclosureDownloadingState) == DownloadState.InProgress)
                {
                    string enclosureTempFile = feedItem.GetPropText(Props.EnclosureTempFile);
                    if (File.Exists(enclosureTempFile))
                    {
                        try
                        {
                            file          = File.OpenWrite(enclosureTempFile);
                            destFullPath  = enclosureTempFile;
                            startPosition = (int)file.Length;
                            file.Seek(startPosition, SeekOrigin.Begin);
                        }
                        catch (Exception exception)
                        {
                            Tracer._TraceException(exception);
                        }
                    }
                }
                if (destFullPath == null && file == null)
                {
                    destFullPath = FindFreeFileName(enclosureUrl, directory, true);
                    file         = File.Create(destFullPath);
                }

                new ResourceProxy(feedItem).SetProp(Props.EnclosureTempFile, destFullPath);
                Core.NetworkAP.QueueJobAt(at, new DownloadEnclosure(feedItem, file, directory, startPosition));
                _queued = true;
            }
            catch (Exception exception)
            {
                _queued = false;
                ResourceProxy proxy = new ResourceProxy(feedItem);
                proxy.BeginUpdate();
                proxy.SetProp(Props.EnclosureDownloadingState, DownloadState.Failed);
                proxy.SetProp(Props.EnclosureFailureReason, exception.Message);
                proxy.EndUpdate();
                ShowDesktopAlert(DownloadState.Failed, "Downloading Failed", feedItem.DisplayName, exception.Message);
                EnclosureDownloadManager.DownloadNextEnclosure();
            }
        }
Exemplo n.º 19
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            IResourceList flags = actionStore.ParametersAsResList();
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("Flag", flags[0]);
            proxy.EndUpdate();
        }
Exemplo n.º 20
0
        public static void RemoveFromSync(IResource contact, string newEntryID)
        {
            ResourceProxy proxy = new ResourceProxy(contact);

            proxy.BeginUpdate();
            proxy.SetProp(PROP.EntryID, newEntryID);
            proxy.SetProp("UserCreated", true);
            proxy.EndUpdateAsync();
        }
Exemplo n.º 21
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            string oldPath = e.OldFullPath;
            string newPath = e.FullPath;

            Trace.WriteLineIf(TraceWatchers(), "OnRenamed( " + oldPath + " -> " + newPath + " )", "FilePlugin");

            if (Directory.Exists(newPath))
            {
                DirectoryInfo di = IOTools.GetDirectoryInfo(newPath);
                if (di != null)
                {
                    newPath = IOTools.GetFullName(di);
                }
                IResource folder = FindDirectory(oldPath);
                RenameDirectory(folder, e.Name, newPath);
            }
            else
            {
                FileInfo fi = IOTools.GetFileInfo(newPath);
                if (fi != null)
                {
                    newPath = IOTools.GetFullName(fi);
                }
                IResource file = FindFile(oldPath);
                if (file == null)
                {
                    FileInfo fileInfo = IOTools.GetFileInfo(newPath);
                    FindOrCreateFile(fileInfo, false);
                }
                else
                {
                    string        directory = Path.GetDirectoryName(newPath);
                    string        filename  = IOTools.GetFileName(newPath);
                    IResource     folder    = FindDirectory(directory);
                    ResourceProxy proxy     = new ResourceProxy(file);
                    proxy.BeginUpdate();
                    try
                    {
                        proxy.SetProp(FileProxy._propDirectory, directory);
                        proxy.SetProp(Core.Props.Name, filename);
                        if (folder != null)
                        {
                            proxy.SetProp(FileProxy._propParentFolder, folder);
                        }
                    }
                    finally
                    {
                        proxy.EndUpdate();
                    }
                }
            }
        }
Exemplo n.º 22
0
        protected override void SetArticleNumbersRange(ref int firstArticle, ref int lastArticle)
        {
            int headersCount2Get   = GetHeadersCount();
            int currentLastArticle = _group.LastArticle;

            // first time last article is not set
            if (currentLastArticle == 0)
            {
                currentLastArticle = lastArticle - headersCount2Get;
                if (currentLastArticle < firstArticle - 1)
                {
                    currentLastArticle = firstArticle - 1;
                }
            }
            else
            {
                if (firstArticle > currentLastArticle)
                {
                    currentLastArticle = firstArticle - 1;
                }
                else if (_group.FirstArticle > lastArticle)
                {
                    ResourceProxy proxy = new ResourceProxy(_group.Resource);
                    proxy.BeginUpdate();
                    try
                    {
                        proxy.DeleteProp(NntpPlugin._propFirstArticle);
                        proxy.DeleteProp(NntpPlugin._propLastArticle);
                    }
                    finally
                    {
                        proxy.EndUpdateAsync();
                    }
                }
            }
            if (headersCount2Get < lastArticle - currentLastArticle)
            {
                lastArticle  = currentLastArticle + headersCount2Get;
                firstArticle = currentLastArticle + 1;
            }
            else
            {
                headersCount2Get = lastArticle - currentLastArticle;
                if (headersCount2Get <= 0)
                {
                    lastArticle = 0;
                }
                else
                {
                    firstArticle = currentLastArticle + 1;
                }
            }
        }
Exemplo n.º 23
0
        public IResource ReregisterRule(IResource baseRes, string name, string[] types,
                                        IResource[] conditions, IResource[] exceptions,
                                        bool isBold, bool isItalic, bool isUnderlined, bool isStrikeout,
                                        string foreColor, string backColor)
        {
            ResourceProxy proxy = new ResourceProxy(baseRes);

            proxy.BeginUpdate();
            FilterRegistry.InitializeView(proxy, name, types, conditions, exceptions);
            AddSpecificParams(baseRes, name, isBold, isItalic, isUnderlined, isStrikeout, foreColor, backColor);
            return(baseRes);
        }
Exemplo n.º 24
0
        private void  LinkWithWorkspaces()
        {
            ResourceProxy proxy = new ResourceProxy(BaseResource);

            proxy.BeginUpdate();
            proxy.DeleteLinks("InWorkspace");
            foreach (IResource wsp in linkedWsps)
            {
                proxy.SetProp("InWorkspace", wsp);
            }
            proxy.EndUpdate();
        }
Exemplo n.º 25
0
        public static void RemoveFromSync(IResource contact, bool removeEntryID)
        {
            ResourceProxy proxy = new ResourceProxy(contact);

            proxy.AsyncPriority = JobPriority.Immediate;
            proxy.BeginUpdate();
            if (removeEntryID)
            {
                proxy.DeleteProp(PROP.EntryID);
            }
            proxy.SetProp("UserCreated", true);
            proxy.EndUpdateAsync();
        }
Exemplo n.º 26
0
        public static void SetCheckNeeded(string protocol, bool check)
        {
            IResource resProtocol = Core.ResourceStore.FindUniqueResource(PROTOCOL_HANDLER, _propProtocol, protocol);

            if (resProtocol != null)
            {
                ResourceProxy proxy = new ResourceProxy(resProtocol);
                proxy.BeginUpdate();
                proxy.AsyncPriority = JobPriority.Immediate;
                proxy.SetProp(_propCheck, check);
                proxy.EndUpdate();
            }
        }
Exemplo n.º 27
0
        public IResource  ReregisterTrayIconRule(IResource rule, string name, string[] types,
                                                 IResource[][] conditions, IResource[] exceptions,
                                                 Icon icon)
        {
            UnregisterIconWatcherImpl(rule.DisplayName, false);
            ResourceProxy proxy = new ResourceProxy(rule);

            proxy.BeginUpdate();
            FilterRegistry.InitializeView(proxy, name, types, conditions, exceptions);

            Core.ResourceAP.RunUniqueJob(new AssignmentDelegate(AddSpecificParams), rule, name, icon);
            InitializeWatcher(rule, name, icon);
            return(rule);
        }
Exemplo n.º 28
0
        private static void AddSpecificParams(IResource rule, string name, bool isBold, bool isItalic,
                                              bool isUnderlined, bool isStrikeout, string foreColor, string backColor)
        {
            ResourceProxy proxy = new ResourceProxy(rule);

            proxy.BeginUpdate();
            proxy.SetProp("IsFormattingFilter", true);
            proxy.SetProp("DeepName", name);
            if (isBold)
            {
                proxy.SetProp("IsBold", true);
            }
            else
            {
                proxy.DeleteProp("IsBold");
            }
            if (isItalic)
            {
                proxy.SetProp("IsItalic", true);
            }
            else
            {
                proxy.DeleteProp("IsItalic");
            }
            if (isUnderlined)
            {
                proxy.SetProp("IsUnderline", true);
            }
            else
            {
                proxy.DeleteProp("IsUnderline");
            }
            if (isStrikeout)
            {
                proxy.SetProp("IsStrikeout", true);
            }
            else
            {
                proxy.DeleteProp("IsStrikeout");
            }
            proxy.SetProp("ForeColor", foreColor);
            proxy.SetProp("BackColor", backColor);

            //  Keep also the date of creation/last modification.
            //  It will allow us to order rules in the future.
            proxy.SetProp(Core.Props.Date, DateTime.Now);

            proxy.EndUpdate();
        }
Exemplo n.º 29
0
        private static ResourceProxy  GetRuleProxy(IResource rule)
        {
            ResourceProxy proxy;

            if (rule != null)
            {
                proxy = new ResourceProxy(rule);
                proxy.BeginUpdate();
            }
            else
            {
                proxy = ResourceProxy.BeginNewResource(FilterManagerProps.ViewCompositeResName);
            }
            return(proxy);
        }
Exemplo n.º 30
0
        public void Sync(RemoteField itemJira)
        {
            ResourceProxy proxy = new ResourceProxy(Resource, AsyncPriority);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Name, itemJira.name);
            if (Async)
            {
                proxy.EndUpdateAsync();
            }
            else
            {
                proxy.EndUpdate();
            }
        }