Ejemplo n.º 1
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();
                }
            }
        }
Ejemplo n.º 2
0
 public void Exec(IResource resource, IActionParameterStore actionStore)
 {
     if (resource != null)
     {
         IResource task = NewTaskAction.CreateTask(resource.ToResourceList(), null);
         task.EndUpdate();
     }
 }
Ejemplo n.º 3
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("IsUnread", true);
            proxy.EndUpdate();
        }
Ejemplo n.º 4
0
        public void  Exec(IResource res, IActionParameterStore actionStore)
        {
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            proxy.SetProp("Importance", 1);
            proxy.EndUpdate();
        }
Ejemplo n.º 5
0
        public bool MatchResource(IResource res, IActionParameterStore actionStore)
        {
            string pattern = actionStore.ParameterAsString();

            stream.Init();
            Core.PluginLoader.InvokeResourceTextProviders(res, stream);
            return(stream.Body.IndexOf(pattern) != -1);
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
        public void  Exec(IResource res, IActionParameterStore actionStore)
        {
            IResourceList categories = actionStore.ParametersAsResList();

            foreach (IResource category in categories)
            {
                Core.CategoryManager.AddResourceCategory(res, category);
            }
        }
Ejemplo n.º 8
0
        public void  Exec(IResource res, IActionParameterStore actionStore)
        {
            IResourceDeleter deleter = Core.PluginLoader.GetResourceDeleter(res.Type);

            if (deleter != null)
            {
                deleter.DeleteResourcePermanent(res);
            }
        }
Ejemplo n.º 9
0
 public void Exec(IResource resource, IActionParameterStore actionStore)
 {
     if (resource != null)
     {
         foreach (IResource task in actionStore.ParametersAsResList())
         {
             resource.AddLink(TasksPlugin._linkTarget, task);
         }
     }
 }
Ejemplo n.º 10
0
        public bool MatchResource(IResource res, IActionParameterStore actionStore)
        {
            IResourceList contacts = actionStore.ParametersAsResList();
            IResourceList linked   = res.GetLinksOfType(null, Core.ContactManager.Props.LinkFrom);

            linked = linked.Union(res.GetLinksOfType(null, Core.ContactManager.Props.LinkTo), true);
            linked = linked.Intersect(contacts, true);

            return(linked.Count > 0);
        }
Ejemplo n.º 11
0
        public bool MatchResource(IResource res, IActionParameterStore actionStore)
        {
            IResourceList threadHeads = actionStore.ParametersAsResList();
            IResource     msg         = res;

            while (msg != null && threadHeads.IndexOf(msg) == -1)
            {
                msg = msg.GetLinkProp(Core.Props.Reply);
            }
            return(msg != null);
        }
Ejemplo n.º 12
0
 public void Exec(IResource res, IActionParameterStore actionStore)
 {
     if (Core.State != CoreState.ShuttingDown)
     {
         TimeSpan ts = DateTime.Now - _lastNotificationTime;
         if (ts.TotalMilliseconds > 500)
         {
             Core.UIManager.QueueUIJob(new ResourceDelegate(Core.UIManager.ShowDesktopAlert),
                                       res);
             _lastNotificationTime = DateTime.Now;
         }
     }
 }
Ejemplo n.º 13
0
            public void Exec(IResource res, IActionParameterStore actionStore)
            {
                IResourceList authors = res.GetLinksOfType("Contact", Core.ContactManager.Props.LinkFrom);

                foreach (IResource contact in authors)
                {
                    IResourceList addrBooks = actionStore.ParametersAsResList();
                    foreach (IResource addrBook in addrBooks)
                    {
                        new AddressBook(addrBook).AddContact(contact);
                    }
                }
            }
Ejemplo n.º 14
0
        public IResourceList Filter(string resType, IActionParameterStore actionStore)
        {
            IResourceList categories = actionStore.ParametersAsResList();

            categories = CategoriesTree(categories);
            IResourceList result = Core.ResourceStore.EmptyResourceList;

            foreach (IResource category in categories)
            {
                result = result.Union(category.GetLinksOfType(null, "Category"));
            }
            result = result.Minus(Core.ResourceStore.GetAllResources("Category"));
            return(result);
        }
Ejemplo n.º 15
0
        public IResourceList Filter(string resType, IActionParameterStore actionStore)
        {
            IResourceList contacts = actionStore.ParametersAsResList();
            IResourceList result   = Core.ResourceStore.EmptyResourceList;

            lock ( contacts )
            {
                foreach (IResource contact in contacts)
                {
                    result = result.Union(ContactManager.LinkedCorrespondenceDirect(contact));
                }
            }
            return(result);
        }
Ejemplo n.º 16
0
        public void Exec(IResource res, IActionParameterStore actionStore)
        {
            Guard.NullArgument(res, "res");
            Guard.NullArgument(actionStore, "actionStore");
            if (res.Type != "RSSItem")
            {
                throw new ArgumentException("EnclosureDownloadRuleAction was registered for RSSItem only but there resource with type = '" + res.Type + "'");
            }
            Tracer._Trace("Execute rule: EnclosureDownloadRuleAction");

            if (res.HasProp(Props.EnclosureURL))
            {
                EnclosureDownloadManager.PlanToDownload(res);
            }
        }
Ejemplo n.º 17
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            string        val   = actionStore.ParameterAsString().ToLower();
            ResourceProxy proxy = new ResourceProxy(res);

            proxy.BeginUpdate();
            if (val == "1" || val == "-1")
            {
                proxy.SetProp(STR.Importance, Int32.Parse(val));
            }
            else
            {
                proxy.DeleteProp(STR.Importance);
            }
            proxy.EndUpdate();
        }
Ejemplo n.º 18
0
        public bool MatchResource(IResource res, IActionParameterStore actionStore)
        {
            bool match = false;

            if (res.Type != "Category")
            {
                IResourceList linkedCategories = res.GetLinksOfType("Category", "Category");
                if (linkedCategories.Count > 0)
                {
                    IResourceList matchCats = actionStore.ParametersAsResList();
                    matchCats = CategoriesTree(matchCats);
                    match     = (matchCats.Intersect(linkedCategories, true).Count > 0);
                }
            }
            return(match);
        }
Ejemplo n.º 19
0
 public void Exec(IResource resource, IActionParameterStore actionStore)
 {
     Tracer._Trace("Execute rule: DeleteMessageRuleAction");
     if (resource == null || resource.Type != STR.Email)
     {
         return;
     }
     try
     {
         PairIDs messageIDs = PairIDs.Get(resource);
         OutlookSession.DeleteMessage(messageIDs.StoreId, messageIDs.EntryId, true);
     }
     catch (Exception exception)
     {
         Tracer._TraceException(exception);
     }
 }
Ejemplo n.º 20
0
        public void Exec(IResource resource, IActionParameterStore actionStore)
        {
            Tracer._Trace("Execute rule: MoveToFolderRuleAction");
            if (resource == null || resource.Type != STR.Email)
            {
                return;
            }

            IResourceList folders = actionStore.ParametersAsResList();

            if (folders != null && folders.Count > 0)
            {
                IResource folder = folders[0];
                if (folder.Type == STR.MAPIFolder)
                {
                    OutlookSession.OutlookProcessor.QueueJob(JobPriority.Normal, "Move message to folder rule action",
                                                             new ResourceList_ResourceDelegate(ExecImpl), resource.ToResourceList(), folder);
                }
            }
        }
Ejemplo n.º 21
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            string  fileName = actionStore.ParameterAsString();
            Process process  = new Process();

            Trace.WriteLine("RunApplcationAction - starting " + fileName);

            try
            {
                process.StartInfo.FileName         = fileName;
                process.StartInfo.WorkingDirectory = ".";
                process.StartInfo.CreateNoWindow   = true;
                process.StartInfo.UseShellExecute  = false;
                if (!process.Start())
                {
                    throw(new Exception("RunApplcationAction - Aplication did not managed to" +
                                        "call Start for the process with filename: " + fileName));
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine("RunApplcationAction - failed to start application with reason: " + e.Message);
            }
        }
Ejemplo n.º 22
0
 public IResourceList Filter(string resType, IActionParameterStore actionStore)
 {
     throw new NotSupportedException("FilterRegistry -- this condition can be used only in Action or Formatting rules.");
 }
Ejemplo n.º 23
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            string soundFileName = actionStore.ParameterAsString();

            WindowsMultiMedia.PlaySound(soundFileName, (IntPtr)0, WindowsMultiMedia.SND_FILENAME);
        }
Ejemplo n.º 24
0
        public void   Exec(IResource res, IActionParameterStore actionStore)
        {
            string message = actionStore.ParameterAsString();

            DelayedExec(res, message);
        }