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); }
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(); } }
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); }
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(); }
/// <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); }
/// <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); } }
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(); } }
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(); }
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); } }
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(); } }
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); }
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); }
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); }
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); } }
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); }
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(); } } }
private static void SetLinkToParent(IResource newView, IResource parentRes) { ResourceProxy proxy = new ResourceProxy(newView); proxy.BeginUpdate(); proxy.SetProp(Core.Props.Parent, parentRes); proxy.EndUpdate(); }
public void Exec(IResource res, IActionParameterStore actionStore) { ResourceProxy proxy = new ResourceProxy(res); proxy.BeginUpdate(); proxy.SetProp("Importance", 1); proxy.EndUpdate(); }
public void Exec(IResource res, IActionParameterStore actionStore) { ResourceProxy proxy = new ResourceProxy(res); proxy.BeginUpdate(); proxy.SetProp("IsUnread", true); proxy.EndUpdate(); }
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(); }
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(); } }
/// <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(); }
public override void Execute(IActionContext context) { ResourceProxy proxy = ResourceProxy.BeginNewResource("Note"); proxy.SetProp(Core.Props.Subject, "New note"); proxy.EndUpdate(); NoteEditor editor = new NoteEditor(); Core.UIManager.OpenResourceEditWindow(editor, proxy.Resource, true); }
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); }
private TResourceObject CreateNewResource(TJira itemJira) { ResourceProxy proxy = ResourceProxy.BeginNewResource(_restype); proxy.SetProp(Props.JiraId, itemJira.id); proxy.AddLink(Core.Props.Parent, _server.Resource); proxy.EndUpdate(); return(CreateResourceObject(proxy.Resource)); }
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(); } } } }
private void LinkWithWorkspaces() { ResourceProxy proxy = new ResourceProxy(BaseResource); proxy.BeginUpdate(); proxy.DeleteLinks("InWorkspace"); foreach (IResource wsp in linkedWsps) { proxy.SetProp("InWorkspace", wsp); } proxy.EndUpdate(); }
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(); } }
/// <summary> /// While syncing to JIRA, creates a new Omea resource for the locally-missing project. /// </summary> /// <returns></returns> protected JiraProject CreateProject(RemoteProject projectJira) { ResourceProxy proxy = ResourceProxy.BeginNewResource(Types.JiraProject); proxy.AsyncPriority = JobPriority.Normal; proxy.SetProp(Props.JiraId, projectJira.id); proxy.AddLink(Core.Props.Parent, Resource); proxy.EndUpdate(); return(GetProject(proxy.Resource)); }
/// <summary> /// Creates a new JIRA server resource. /// </summary> public static JiraServer CreateNew() { ResourceProxy proxy = ResourceProxy.BeginNewResource(Type); proxy.AddLink(Core.Props.Parent, RootResource); proxy.EndUpdate(); JiraServer retval = new JiraServer(proxy.Resource); retval.Name = Jiffa.GetRandomName(); return(retval); }