Example #1
0
        public override AbstractJob GetNextJob()
        {
            RSSUnitOfWork nextJob = null;

            if (_currentFeed != _feedUrls.Length)
            {
                string status = "Processing: " + _feedNames[_currentFeed];
                Trace.WriteLine("MultipleFeedsJob -- Processing: " + _feedNames[_currentFeed]);
                if (DownloadTitleProgress != null)
                {
                    DownloadTitleProgress(this, new DownloadProgressEventArgs(status));
                }

                ResourceProxy proxy = ResourceProxy.BeginNewResource("RSSFeed");
                proxy.SetProp(Props.Transient, 1);
                proxy.SetProp(Props.URL, _feedUrls[_currentFeed] + _query);
                proxy.SetProp(Props.RSSSearchPhrase, _searchPhrase);
                proxy.SetProp(Core.Props.Name, _feedNames[_currentFeed++] + ": \"" + _query + "\"");
                proxy.EndUpdate();
                _feedProxies.Add(proxy);

                nextJob = new RSSUnitOfWork(proxy.Resource, false, true);
                nextJob.DownloadProgress += DownloadProgress;
                nextJob.ParseDone        += JobParseDone;
            }
            return(nextJob);
        }
Example #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();
            }
        }
Example #3
0
        private void ParseNextCandidate()
        {
            PriorityQueue.QueueEntry qEntry = _candidateURLs.PopEntry();
            if (qEntry == null)
            {
                OnDiscoverDone();
                return;
            }
            if (_lastPriority != -1 && qEntry.Priority != _lastPriority && qEntry.Priority < 9 && _results.Count > 0)
            {
                OnDiscoverDone();
                return;
            }

            _lastPriority = qEntry.Priority;

            ResourceProxy newFeedProxy = ResourceProxy.BeginNewResource("RSSFeed");

            newFeedProxy.SetProp("Transient", 1);
            newFeedProxy.SetProp("URL", (string)qEntry.Value);
            newFeedProxy.EndUpdate();
            _lastFeed = newFeedProxy.Resource;

            _lastUnitOfWork = new RSSUnitOfWork(_lastFeed, false, true);
            _lastUnitOfWork.DownloadProgress += new DownloadProgressEventHandler(RSSDownloadProgress);
            _lastUnitOfWork.ParseDone        += new EventHandler(RSSParseDone);
            Core.NetworkAP.QueueJob(_lastUnitOfWork);
        }
Example #4
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);
     }
 }
Example #5
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);
        }
Example #6
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);
        }
Example #7
0
        public static void SetSeeAllAndNoIgnoreAsync(IResource folder)
        {
            ResourceProxy proxy = new ResourceProxy(folder);

            proxy.SetProp(PROP.SeeAll, true);
            proxy.SetProp(PROP.IgnoredFolder, 0);
        }
Example #8
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();
        }
Example #9
0
        private void DoAddRepository(object sender, EventArgs e)
        {
            string   repTypeId  = null;
            MenuItem senderItem = (MenuItem)sender;

            foreach (RepositoryType repType in SccPlugin.RepositoryTypes)
            {
                if (repType.Name == senderItem.Text)
                {
                    repTypeId = repType.Id;
                    break;
                }
            }
            if (repTypeId == null)
            {
                return;
            }

            ResourceProxy proxy = ResourceProxy.BeginNewResource(Props.RepositoryResource);

            proxy.SetProp(Core.Props.Name, "<unnamed>");
            proxy.SetProp(Props.RepositoryType, repTypeId);
            proxy.AddLink(Core.Props.Parent, Core.ResourceTreeManager.GetRootForType(Props.RepositoryResource));
            proxy.EndUpdate();

            SccPlugin.GetRepositoryType(repTypeId).EditRepository(this, proxy.Resource);

            RefreshRepositoryList(proxy.Resource);
        }
Example #10
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);
        }
Example #11
0
        public ResourceFlag(string flagID, string name, string iconAssembly, string iconName)
        {
            if (!_typesRegistered)
            {
                Core.ResourceAP.RunJob(new MethodInvoker(RegisterTypes));
            }

            _resource = Core.ResourceStore.FindUniqueResource("Flag", "FlagId", flagID);
            if (_resource == null)
            {
                ResourceProxy proxy = ResourceProxy.BeginNewResource("Flag");
                proxy.SetProp(Core.Props.Name, name);
                proxy.SetProp(_propFlagId, flagID);
                proxy.SetProp(_propIconAssembly, iconAssembly);
                proxy.SetProp(_propIconName, iconName);
                proxy.EndUpdate();

                _resource = proxy.Resource;
            }
            else
            {
                ResourceProxy proxy = new ResourceProxy(_resource);
                proxy.SetProp(_propIconAssembly, iconAssembly);
                proxy.SetProp(_propIconName, iconName);
            }
        }
Example #12
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);
            }
        }
Example #13
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();
            }
        }
Example #14
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();
        }
Example #15
0
        /// <summary>
        /// Adds a shortcut to the specified resource to the shortcut bar.
        /// </summary>
        public void AddShortcutToResource(IResource newShortcut)
        {
            ITabManager tabManager      = Core.TabManager;
            IResource   activeWorkspace = Core.WorkspaceManager.ActiveWorkspace;

            IResourceList shortcutTargets = newShortcut.GetLinksOfType("Shortcut", ShortcutProps.Target);

            if (newShortcut.Type == "SearchView")
            {
                foreach (IResource res in shortcutTargets)
                {
                    if (res.GetStringProp(ShortcutProps.TabID) == tabManager.CurrentTabId &&
                        res.GetLinkProp(ShortcutProps.Workspace) == activeWorkspace)
                    {
                        return;
                    }
                }
            }
            else
            {
                if (shortcutTargets.Count > 0)
                {
                    return;
                }
            }

            ResourceProxy proxy = ResourceProxy.BeginNewResource("Shortcut");

            proxy.SetProp(ShortcutProps.Order, _maxOrder + 1);
            proxy.AddLink(ShortcutProps.Target, newShortcut);

            if (activeWorkspace != null)
            {
                proxy.AddLink(ShortcutProps.Workspace, activeWorkspace);
            }

            if (newShortcut.Type == "SearchView")
            {
                proxy.SetProp(ShortcutProps.TabID, tabManager.CurrentTabId);
                string wsName = "";
                if (activeWorkspace != null)
                {
                    wsName = " in " + activeWorkspace.GetStringProp(Core.Props.Name);
                }

                proxy.SetProp(Core.Props.Name, tabManager.CurrentTab.Name + wsName + ": " +
                              newShortcut.DisplayName);
            }
            else if (newShortcut.DisplayName.Length > 20)
            {
                proxy.SetProp(Core.Props.Name, newShortcut.DisplayName.Substring(0, 20) + "...");
            }
            proxy.EndUpdate();
            RebuildShortcutBar();
        }
Example #16
0
        private void _btnNewGroup_Click(object sender, System.EventArgs e)
        {
            ResourceProxy proxy = ResourceProxy.BeginNewResource("RSSFeedGroup");

            proxy.SetProp(Core.Props.Name, "<new folder>");
            proxy.SetProp(Core.Props.Parent, SelectedGroup);
            proxy.EndUpdate();
            _lastNewGroup = proxy.Resource;

            _feedGroupTree.EditResourceLabel(_lastNewGroup);
        }
Example #17
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();
                    }
                }
            }
        }
Example #18
0
 protected static void SetChangeSetDescription(ResourceProxy proxy, string desc)
 {
     proxy.SetProp(Core.Props.LongBody, desc);
     desc = desc.Replace("\r\n", " ");
     if (desc.Length < 50)
     {
         proxy.SetProp(Core.Props.Subject, desc);
     }
     else
     {
         proxy.SetProp(Core.Props.Subject, desc.Substring(0, 50) + "...");
     }
 }
Example #19
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);
        }
Example #20
0
 private static void SaveProtocolSettings(ResourceProxy proxy, string friendlyName, Default defProtocol)
 {
     CheckRegistration();
     proxy.AsyncPriority = JobPriority.Immediate;
     proxy.SetProp(_propFriendlyName, friendlyName);
     if (defProtocol != Default.NoChanges)
     {
         proxy.SetProp(_propDefault, defProtocol == Default.Yes);
     }
     proxy.EndUpdate();
     if (proxy.Resource.HasProp(_propDefault))
     {
         ProtocolHandlersInRegistry.SetAsDefaultHandler(proxy.Resource.GetPropText(_propProtocol), friendlyName);
     }
 }
Example #21
0
        protected virtual void WriteImpl(object value)
        {
            ResourceProxy proxy = new ResourceProxy(_resource);

            proxy.AsyncPriority = JobPriority.Immediate;
            proxy.SetProp(_propId, value);
        }
Example #22
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();
            }
        }
Example #23
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) {}
        }
Example #24
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();
            }
        }
Example #25
0
 public static void Do(IResource mail)
 {
     if (Settings.MarkAsReadOnReply)
     {
         ResourceProxy mailProxy = new ResourceProxy(mail);
         mailProxy.SetProp(Core.Props.IsUnread, false);
     }
 }
Example #26
0
        public void Sync(RemoteStatus itemJira)
        {
            ResourceProxy proxy = new ResourceProxy(Resource, AsyncPriority);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Name, itemJira.name);
            proxy.SetProp(Core.Props.LongBody, itemJira.description);
            proxy.SetProp(Props.IconUri, itemJira.icon);
            if (Async)
            {
                proxy.EndUpdateAsync();
            }
            else
            {
                proxy.EndUpdate();
            }
        }
Example #27
0
        private static void SetLinkToParent(IResource newView, IResource parentRes)
        {
            ResourceProxy proxy = new ResourceProxy(newView);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Parent, parentRes);
            proxy.EndUpdate();
        }
Example #28
0
        protected override void Execute()
        {
            if (_resource.Id != -1 && _resource.GetIntProp(Props.EnclosureDownloadingState) != DownloadState.NotDownloaded)
            {
                // Determine if we want update some of the resource properties (create proxy for that)
                int  nTotalLength  = GetLength();
                bool bUpdateState  = _resource.GetIntProp(Props.EnclosureDownloadingState) != DownloadState.InProgress;
                bool bUpdateLength = ((nTotalLength > 0) && (nTotalLength != _resource.GetIntProp(Props.EnclosureSize)));
                if ((bUpdateState) || (bUpdateLength))
                {
                    ResourceProxy proxy = new ResourceProxy(_resource);
                    proxy.BeginUpdate();
                    if (bUpdateState)
                    {
                        proxy.SetProp(Props.EnclosureDownloadingState, DownloadState.InProgress);
                    }
                    if (bUpdateLength)
                    {
                        proxy.SetProp(Props.EnclosureSize, nTotalLength + _startPosition);
                    }
                    proxy.EndUpdateAsync();
                }

                // Check if the downloaded size should be updated
                // As we take the actual size from the disc file, not from the property, its accuracy is not needed; overwrite the property only if the percent value changes, as it's used only for the percentage display
                if (nTotalLength > 0)                                                                                                                     // The total-size info is available (if it's not, we do not have the percentage anyway)
                {
                    int nSize    = GetDownloadedSize();                                                                                                   // Size we've downloaded
                    int nOldSize = _resource.GetIntProp(Props.EnclosureDownloadedSize);                                                                   // The prev size property value
                    if ((nSize * 100 / nTotalLength) != (nOldSize * 100 / nTotalLength))                                                                  // Percentage has changed, should write a new value
                    {
                        Core.UserInterfaceAP.QueueJob("Update Enclosure Downloaded Size", new UpdateDownloadedSizeDelegate(UpdateDownloadedSize), nSize); // Schedulle to the UI AP so that it merges the too-frequent updates for enclosures that download too fast, that reduces flicker
                    }
                }

                // Do the download step
                base.Execute();
            }
            else
            {
                InvokeAfterWait(null, null);
                new ResourceProxy(_resource).SetProp(Props.EnclosureDownloadingState, DownloadState.NotDownloaded);
                _queued = false;
                EnclosureDownloadManager.DownloadNextEnclosure();
            }
        }
Example #29
0
        public void Sync(RemoteUser itemJira)
        {
            ResourceProxy proxy = new ResourceProxy(Resource, AsyncPriority);

            proxy.BeginUpdate();
            proxy.SetProp(Core.Props.Name, itemJira.name);
            proxy.SetProp(Props.FullName, itemJira.fullname);
            proxy.SetProp(Props.Email, itemJira.email);
            if (Async)
            {
                proxy.EndUpdateAsync();
            }
            else
            {
                proxy.EndUpdate();
            }
        }
Example #30
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("IsUnread", true);
            proxy.EndUpdate();
        }