Exemplo n.º 1
0
        public void    ShowAnnotation(IResource res, bool isPersistentMode, bool focus)
        {
            _resource        = res;
            IsPersistentMode = isPersistentMode;
            SourceText       = res.GetPropText(Core.Props.Annotation);

            // [Clear and] Set a watcher on the annotation text which
            // can be changed outside the Omea.
            if (_ResourceChangeWatcher != null)
            {
                _ResourceChangeWatcher.ResourceChanged -= _ResourceChangeWatcher_ResourceChanged;
                _ResourceChangeWatcher.Dispose();
            }
            _ResourceChangeWatcher = _resource.ToResourceListLive();
            _ResourceChangeWatcher.AddPropertyWatch(Core.Props.Annotation);
            _ResourceChangeWatcher.ResourceChanged += _ResourceChangeWatcher_ResourceChanged;

            WriteText(SourceText);

            if (_defaultPosition)
            {
                Bounds           = GetDefaultPosition();
                _defaultPosition = false;
            }

            Show();
            if (!focus)
            {
                Core.ResourceBrowser.FocusResourceList();
            }
            else
            {
                Focus();
            }
        }
Exemplo n.º 2
0
 private void DisposeArticleListener()
 {
     if (_articleListener != null)
     {
         _articleListener.Dispose();
         _articleListener = null;
     }
 }
Exemplo n.º 3
0
        private void ReminderForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Core.SettingStore.WriteInt("Tasks", "ReminderInterval", _snoozePeriodList.SelectedIndex);

            _taskLive.Dispose();
            _reminderForm  = null;
            _switchingDone = false;
        }
Exemplo n.º 4
0
 private void DisposeContactResourceList()
 {
     if (_contactResourceList != null)
     {
         _contactResourceList.ResourceChanged -= OnContactChanged;
         _contactResourceList.Dispose();
         _contactResourceList = null;
     }
 }
Exemplo n.º 5
0
        /**
         * Disposes the live resource list used for tracking the changes of the
         * currently displayed conversation.
         */

        private void DisposeCurrentConversation()
        {
            if (_currentConvList != null)
            {
                _currentConvList.Dispose();
                _currentConvList = null;
            }
            _wordsToHighlight = null;
        }
Exemplo n.º 6
0
 private void DisposeContactResourceList()
 {
     if (_taskListener != null)
     {
         _taskListener.ResourceChanged -= OnContactChanged;
         _taskListener.Dispose();
         _taskListener = null;
     }
 }
Exemplo n.º 7
0
 private void DisposeWatchList()
 {
     if (_resourceWatchList != null)
     {
         _resourceWatchList.ResourceDeleting -= OnEditedResourceDeleting;
         _resourceWatchList.Dispose();
         _resourceWatchList = null;
     }
 }
Exemplo n.º 8
0
 private void ListDispose()
 {
     if (_resources != null)
     {
         _resources.ResourceAdded    -= new ResourceIndexEventHandler(_resources_Updated);
         _resources.ResourceDeleting -= new ResourceIndexEventHandler(_resources_Updated);
         _resources.Dispose();
         _resources = null;
     }
 }
Exemplo n.º 9
0
 protected override void RunTests()
 {
     for (int i = 0; i < 1000; i++)
     {
         IResourceList allEmails = _store.GetAllResourcesLive("Email");
         allEmails.ResourceAdded    += new ResourceIndexEventHandler(allEmails_ResourceAdded);
         allEmails.ResourceDeleting += new ResourceIndexEventHandler(allEmails_ResourceDeleting);
         int cnt = allEmails.Count; cnt = cnt;
         allEmails.Dispose();
     }
 }
Exemplo n.º 10
0
        private void SetWorkspaceWatchList(IResource workspace)
        {
            if (_lastWorkspaceWatchList != null)
            {
                _lastWorkspaceWatchList.ResourceChanged -= OnWorkspaceChanged;
                _lastWorkspaceWatchList.Dispose();
            }

            _lastWorkspace          = workspace;
            _lastWorkspaceWatchList = _lastWorkspace.ToResourceListLive();
            _lastWorkspaceWatchList.ResourceChanged += OnWorkspaceChanged;
            _workspaceChanged = false;
        }
Exemplo n.º 11
0
 private void SetFileChangeWatch(IResource fileChange)
 {
     if (_selectedChangeList != null)
     {
         _selectedChangeList.ResourceChanged -= new ResourcePropIndexEventHandler(HandleFileChangeChanged);
         _selectedChangeList.Dispose();
         _selectedChangeList = null;
     }
     if (fileChange != null)
     {
         _selectedChangeList = fileChange.ToResourceListLive();
         _selectedChangeList.ResourceChanged += new ResourcePropIndexEventHandler(HandleFileChangeChanged);
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }

                if (_resourceList != null)
                {
                    _resourceList.Dispose();
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 13
0
 private void SetLastResource(IResource res)
 {
     if (_lastResourceList != null)
     {
         _lastResourceList.ResourceDeleting -= HandleResourceDeleted;
         _lastResourceList.ResourceChanged  -= HandleResourceChanged;
         _lastResourceList.Dispose();
         _lastResourceList = null;
     }
     _lastResource = res;
     if (_lastResource != null)
     {
         _lastResourceList = _lastResource.ToResourceListLive();
         _lastResourceList.ResourceDeleting += HandleResourceDeleted;
         _lastResourceList.ResourceChanged  += HandleResourceChanged;
     }
 }
Exemplo n.º 14
0
 internal void AttachHandlers()
 {
     if (!_handlersAttached)
     {
         _handlersAttached = true;
         if (_parentProp != 0)
         {
             Core.ResourceTreeManager.RegisterTreeListener(_parentResource, _parentProp, this);
             _childResources.Dispose();
         }
         else
         {
             _childResources.ResourceAdded    += new ResourceIndexEventHandler(HandleResourceAdded);
             _childResources.ResourceChanged  += new ResourcePropIndexEventHandler(HandleResourceChanged);
             _childResources.ResourceDeleting += new ResourceIndexEventHandler(HandleResourceDeleting);
         }
     }
 }
Exemplo n.º 15
0
        private void UpdateActiveWorkspace()
        {
            int oldWorkspaceID = (_activeWorkspace == null) ? 0 : _activeWorkspace.Id;

            if (!_selectingLastTab)
            {
                _workspaceTabs[oldWorkspaceID] = _tabBar.SelectedIndex;
            }
            if (_activeWorkspaceWatchList != null)
            {
                _activeWorkspaceWatchList.Dispose();
                _activeWorkspaceWatchList.ResourceChanged -= OnActiveWorkspaceChanged;
                _activeWorkspaceWatchList = null;
            }

            _activeWorkspace = Core.WorkspaceManager.ActiveWorkspace;

            int newWorkspaceID = (_activeWorkspace == null) ? 0 : _activeWorkspace.Id;

            if (_activeWorkspace != null)
            {
                _activeWorkspaceFilterList = Core.WorkspaceManager.GetFilterList(_activeWorkspace);
                _activeWorkspaceWatchList  = _activeWorkspace.ToResourceListLive();
                _activeWorkspaceWatchList.ResourceChanged += OnActiveWorkspaceChanged;
            }
            else
            {
                _activeWorkspaceFilterList = null;
            }

            int newSelectedIndex = GetWorkspaceTab(newWorkspaceID);

            if (newSelectedIndex != _tabBar.SelectedIndex &&
                newSelectedIndex >= 0 && newSelectedIndex < _tabBar.TabCount)
            {
                _tabBar.SelectedIndex = newSelectedIndex;
            }
            else
            {
                UpdateSelectedTab();
            }
        }
Exemplo n.º 16
0
        /**
         * Shows the specified list of correspondents in the pane.
         */

        private void ShowCorrespondents(IResourceList correspondents)
        {
            if (_correspondents != null)
            {
                _correspondents.Dispose();
            }
            _correspondents = correspondents;

            _dataProvider = new ResourceListDataProvider(_correspondents);
            _dataProvider.SetInitialSort(new SortSettings(ResourceProps.DisplayName, true));
            _listContacts.DataProvider = _dataProvider;
            if (_initialSelection != null && _initialSelection.Count > 0)
            {
                _listContacts.Selection.AddIfPresent(_initialSelection [0]);
            }
            else
            {
                EnsureHasSelection();
            }
            if (_selectorMode)
            {
                UpdateCheckedResources();
            }
        }
Exemplo n.º 17
0
        private void UpdateView(IResource view, bool remove)
        {
            IResourceList resList = (IResourceList)_viewToUnreadResources[view.Id];

            if (resList != null)  // possible on view's creation
            {
                _unreadResourcesToView.Remove(resList);
                _viewToUnreadResources.Remove(view.Id);

                DetachFromList(resList);
                resList.Dispose();
            }

            if (!remove && ViewCanBeUnread(view))
            {
                resList = ComputeList(view);

                _unreadResourcesToView[resList] = view;
                _viewToUnreadResources[view.Id] = resList;
                AttachToList(resList);

                _unreadManager.InvalidateUnreadCounter(view);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Fills the chevron bar with shortcut links.
        /// </summary>
        public void RebuildShortcutBar()
        {
            if (_resourcesWithShortcuts != null)
            {
                _resourcesWithShortcuts.ResourceDeleting -= OnResourceWithShortcutDeleting;
                _resourcesWithShortcuts.Dispose();
            }

            _chevronBar.ClearControls();
            using (new LayoutSuspender(_chevronBar))
            {
                IResourceList shortcuts = Core.ResourceStore.GetAllResources("Shortcut");
                shortcuts.Sort(new int[] { ShortcutProps.Order }, true);
                _numShortcuts = shortcuts.Count;
                foreach (IResource shortcut in shortcuts)
                {
                    if (shortcut.IsDeleting)
                    {
                        continue;
                    }

                    IResource target = shortcut.GetLinkProp(ShortcutProps.Target);
                    if (target == null || target.IsDeleting)
                    {
                        // delete the shortcut when its target is deleted
                        new ResourceProxy(shortcut).Delete();
                        continue;
                    }

                    if (!Core.ResourceStore.ResourceTypes[target.Type].OwnerPluginLoaded)
                    {
                        continue;
                    }

                    ResourceLinkLabel lbl = new ResourceLinkLabel();
                    lbl.Resource = target;
                    if (shortcut.HasProp("Name"))
                    {
                        lbl.Text = shortcut.GetStringProp("Name");
                        if (target.DisplayName != lbl.Text)
                        {
                            _tooltip.SetToolTip(lbl.NameLabel, target.DisplayName);
                        }
                    }
                    lbl.Tag = shortcut;
                    lbl.ResourceLinkClicked += OnResourceLinkClicked;
                    lbl.LinkContextMenu     += OnResourceLinkContextMenu;
                    lbl.ResourceDragOver    += OnResourceLinkDragOver;
                    lbl.ResourceDrop        += OnResourceLinkDrop;
                    lbl.Width = lbl.PreferredWidth + 4;
                    _chevronBar.AddControl(lbl);

                    _maxOrder = shortcut.GetIntProp(ShortcutProps.Order);
                }

                _chevronBar.AddHiddenControl(_lblOrganize);
            }

            _resourcesWithShortcuts = Core.ResourceStore.FindResourcesWithPropLive(null, ShortcutProps.Target);
            _resourcesWithShortcuts.ResourceDeleting += OnResourceWithShortcutDeleting;

            if (_site != null)
            {
                _site.PerformLayout(this);
            }
            PerformLayout();
        }
Exemplo n.º 19
0
        protected void AddActionClicked(object sender, EventArgs e)
        {
            ArrayList     usedResources = CollectResourcesInControls(_panelActions.Controls);
            IResourceList actions       = RStore.GetAllResources(FilterManagerProps.RuleActionResName);

            actions = actions.Minus(RStore.FindResources(FilterManagerProps.RuleActionResName, "Invisible", true));
            actions = actions.Union(RStore.GetAllResources(FilterManagerProps.RuleActionTemplateResName));
            foreach (IResource res in usedResources)
            {
                actions = actions.Minus(res.ToResourceList());
            }

            //-----------------------------------------------------------------
            //  Remove those actions and templates which are applicable to the
            //  resource types not supported by the corresponding plugins (if
            //  e.g. they are not loaded). Decision is made using the fact that
            //  actions are ALWAYS implemented as classes (not internal logic),
            //  so if plugin is not loaded, then all of its actions are not
            //  instantiated.
            //-----------------------------------------------------------------
            IResourceList auxList = RStore.EmptyResourceList;

            foreach (IResource res in actions)
            {
                if (Core.FilterRegistry.IsActionInstantiated(res))
                {
                    auxList = auxList.Union(res.ToResourceList());
                }
            }
            actions = auxList;

            //-----------------------------------------------------------------
            IResourceList choosenActions = RStore.EmptyResourceList;

            if (CurrentResTypeDeep != null)
            {
                foreach (IResource res in actions)
                {
                    if (isTypeConforms(CurrentResTypeDeep, res))
                    {
                        choosenActions = choosenActions.Union(res.ToResourceList());
                    }
                }
            }
            else
            {
                choosenActions = actions;
            }

            //-----------------------------------------------------------------
            choosenActions.Sort(new SortSettings(Core.Props.Name, true));
            IResourceList selected = Core.UIManager.SelectResourcesFromList(this, choosenActions,
                                                                            "Select Rule Action(s)", "/reference/select_rule_actions.html");

            if ((selected != null) && (selected.Count > 0))
            {
                ArrayList emptyParams = CreateEmptyList(selected.Count, -1);
                AddConditions(_panelActions, selected, emptyParams);
            }

            actions.Dispose();
            CheckFormConsistency();
        }
Exemplo n.º 20
0
 public override void Dispose()
 {
     _resourceList.Dispose();
 }
Exemplo n.º 21
0
 private void DeleteSelf()
 {
     Core.ResourceStore.DeleteRestrictionOnDelete(_resType);
     _deletedResources.ResourceAdded -= HandleDeletedResourceAdded;
     _deletedResources.Dispose();
 }
Exemplo n.º 22
0
 public void Dispose()
 {
     _workspaceContentsList.ResourceAdded    -= OnWorkspaceContentsChanged;
     _workspaceContentsList.ResourceDeleting -= OnWorkspaceContentsChanged;
     _workspaceContentsList.Dispose();
 }
Exemplo n.º 23
0
 public void EndDisplayResource(IResource resource)
 {
     _changeSetList.ResourceChanged -= new ResourcePropIndexEventHandler(HandleChangesetChanged);
     _changeSetList.Dispose();
     SetFileChangeWatch(null);
 }
Exemplo n.º 24
0
        public void SetResource(IResource resource)
        {
            _refresh.Enabled = false;
            if (resource == null)
            {
                return;
            }

            _properties.BeginUpdate();
            _properties.Items.Clear();
            _resource = resource;
            if (_resourceList != null)
            {
                _resourceList.ResourceChanged -= _resourceList_ResourceChanged;
                _resourceList.Dispose();
            }
            _resourceList = _resource.ToResourceListLive();
            _resourceList.ResourceChanged += _resourceList_ResourceChanged;
            _displayName.Text              = resource.DisplayName;
            _resourceType.Text             = resource.Type;
            if (resource.IsTransient)
            {
                _resourceType.ForeColor = Color.Blue;
                _resourceType.Text     += " (Transient)";
            }

            int linksCount = 0;
            IPropertyCollection properties = resource.Properties;

            foreach (IResourceProperty property in properties)
            {
                if (property.DataType == PropDataType.Link)
                {
                    bool directed = ICore.Instance.ResourceStore.PropTypes[property.PropId].HasFlag(PropTypeFlags.DirectedLink);

                    IResourceList resources = null;
                    string        linkType  = string.Empty;

                    if (!directed)
                    {
                        resources = resource.GetLinksOfType(null, property.Name);
                    }
                    else
                    {
                        if (property.PropId < 0)
                        {
                            resources = resource.GetLinksTo(null, property.Name);
                            linkType  = "To This";
                        }
                        else
                        {
                            resources = resource.GetLinksFrom(null, property.Name);
                            linkType  = "From This";
                        }
                    }
                    linksCount += resources.Count;
                    if (_showLinks.Checked)
                    {
                        foreach (IResource linkedResource in resources)
                        {
                            ListViewItem item = AddListViewItem(property.Name, linkType, property.DataType.ToString(),
                                                                linkedResource.Type + ":" + linkedResource);
                            item.Tag = linkedResource;
                        }
                    }
                }
                else
                {
                    string value = string.Empty;
                    if (property.Value != null)
                    {
                        value = property.Value.ToString();
                    }
                    ListViewItem item = AddListViewItem(property.Name, "", property.DataType.ToString(), value);
                    item.Tag = property.Value;
                }
            }
            AddListViewItem("ID", "", "int", resource.Id.ToString());
            _properties.EndUpdate();
            _showLinks.Text = "Show Links: " + linksCount;
            if (resource.Id == -1)
            {
                Text += " ( resource deleted )";
            }
            else
            {
                Text += " ( id = '" + resource.Id + "' Type = '" + resource.Type + "' DN = '" + resource.DisplayName + "' ) ";
            }
        }