public void RegisterViewsFirstRun() { string[] applType = new string[1] { "Contact" }; IResource res; IFilterRegistry fMgr = Core.FilterRegistry; // Conditions/Templates res = fMgr.CreateConditionTemplate(ContactInABName, ContactInABNameDeep, applType, ConditionOp.In, "AddressBook", "InAddressBook"); fMgr.AssociateConditionWithGroup(res, "Address and Contact Conditions"); res = fMgr.CreateStandardCondition(ContactNotInABName, ContactNotInABNameDeep, applType, "InAddressBook", ConditionOp.HasNoProp); fMgr.AssociateConditionWithGroup(res, "Address and Contact Conditions"); res = fMgr.CreateConditionTemplate(LastCorrespondenceName, LastCorrespondenceNameDeep, applType, ConditionOp.Eq, "LastCorrespondDate"); fMgr.AssociateConditionWithGroup(res, "Temporal Conditions"); IResource condActive = FilterConvertors.InstantiateTemplate(res, "last 30 days", null); // Views IResource viewAll = fMgr.RegisterView("All", applType, (IResource[])null, null); IResource viewActive = fMgr.RegisterView("Active", applType, new IResource[1] { condActive }, null); viewAll.SetProp("DefaultSort", "LastName FirstName"); viewActive.SetProp("DefaultSort", "LastName FirstName"); Core.ResourceTreeManager.LinkToResourceRoot(viewAll, 10); Core.ResourceTreeManager.LinkToResourceRoot(viewActive, 11); viewAll.SetProp("DisableDefaultGroupping", true); viewActive.SetProp("DisableDefaultGroupping", true); }
public void RegisterViewsFirstRun() { // Link all tasks created so far to the root with the // new predefined link. IResourceList list = Core.ResourceStore.GetAllResources("Task"); foreach (IResource res in list) { if (res.GetLinksOfType(null, TasksPlugin._linkSuperTask).Count == 0) { IResource rootTask = res.GetLinkProp(TasksPlugin._linkTarget); res.SetProp(TasksPlugin._linkSuperTask, rootTask); } } // Tasks for "Next Week" view. IFilterRegistry fMgr = Core.FilterRegistry; IStandardConditions std = fMgr.Std; string[] applType = new string[1] { "Task" }; IResource dateRes = fMgr.CreateConditionTemplate(std.ReceivedInTheTimeSpanXName, std.ReceivedInTheTimeSpanXNameDeep, null, ConditionOp.In, "Date"); IResource nextWeekCond = FilterConvertors.InstantiateTemplate(dateRes, "Next Week", null); IResource completed = fMgr.CreateStandardCondition(TasksViewsConstructor.TaskIsCompletedName, TasksViewsConstructor.TaskIsCompletedDeep, applType, "Status", ConditionOp.Eq, "2"); IResource tasksNextWeek = fMgr.RegisterView("Due Next Week", applType, new IResource[1] { nextWeekCond }, new IResource[1] { completed }); Core.ResourceTreeManager.LinkToResourceRoot(tasksNextWeek, 9); }
public override void Execute(IActionContext context) { IResourceList selection = context.SelectedResources; IResource template = Core.ResourceStore.FindUniqueResource(FilterManagerProps.ConditionTemplateResName, "Name", "Locates in %specified% outlook folder"); IResource condition = FilterConvertors.InstantiateTemplate(template, selection, new string[] { "Email" }); Core.FilteringFormsManager.ShowAdvancedSearchForm("", new string[] { "Email" }, new IResource[] { condition }, null); }
/** * Creates a condition with an appropriate parameter from the specified template. */ private IResource BuildRuleCondition(IResource conditionTemplate) { IResource param = GetConditionParameter(conditionTemplate); return(FilterConvertors.InstantiateTemplate(conditionTemplate, param.ToResourceList(), new string[1] { _targetResource.Type })); }
private void okButton_Click(object sender, EventArgs e) { btnOK.Enabled = false; IResource root = _clickedRes; if (_radioThread.Checked) { root = GetRoot(_clickedRes); } else if (_radioCurrentSelection.Checked) { root = _headFormattingRes; } string ruleName = ConstructRuleName(root); if (_clearFormatting) { if (Core.FormattingRuleManager.IsRuleRegistered(ruleName)) { Core.FormattingRuleManager.UnregisterRule(ruleName); } } else { IResource[] conditions = new IResource[1]; conditions[0] = FilterConvertors.InstantiateTemplate(Core.FilterRegistry.Std.MessageIsInThreadOfX, root.ToResourceList(), null); Core.FormattingRuleManager.RegisterRule(ruleName, null, conditions, null, checkBold.Checked, checkItalic.Checked, checkUnderline.Checked, checkStrikeout.Checked, labelSample.ForeColor.Name, panelSample.BackColor.Name); } DeleteRulesUnderTheRoot(root); Core.SettingStore.WriteBool("Rules", "RestoreLastFormatting", checkRememberLast.Checked); Core.SettingStore.WriteBool("Rules", "IsBold", checkBold.Checked); Core.SettingStore.WriteBool("Rules", "IsItalic", checkItalic.Checked); Core.SettingStore.WriteBool("Rules", "IsUnderline", checkUnderline.Checked); Core.SettingStore.WriteBool("Rules", "IsStrikeout", checkStrikeout.Checked); Core.SettingStore.WriteString("Rules", "ForeColor", labelSample.ForeColor.Name); Core.SettingStore.WriteString("Rules", "BackColor", panelSample.BackColor.Name); DialogResult = DialogResult.OK; }
private ArrayList CollectActions() { ArrayList actions = new ArrayList(); foreach (Control ctrl in _panelActions.Controls) { if (ctrl is Label || ctrl is LinkLabel) { LabelInfo info = (LabelInfo)ctrl.Tag; IResource action = info.AssociatedResource; if (isTemplate(action)) { action = FilterConvertors.Template2Action(action, info.Parameters, info.Representation); } actions.Add(action); } } return(actions); }
private void ConstructLists(out IResource[] exceptions, out IResource[] actions) { ArrayList excVector = new ArrayList(), actVector = new ArrayList(); if (radioOlder.Checked) { string paramStr = "Last " + numericOlderValue.Value + " " + (string)comboTimeUnits.Items[comboTimeUnits.SelectedIndex]; IResource dateTemplate = Core.FilterRegistry.Std.ReceivedInTheTimeSpanX; IResource dateExc = FilterConvertors.InstantiateTemplate(dateTemplate, paramStr, null); excVector.Add(dateExc); } //----------------------------------------------------------------- if (checkFlaggedResources.Checked) { excVector.Add(Core.FilterRegistry.Std.ResourceIsFlagged); excVector.Add(Core.FilterRegistry.Std.ResourceIsAnnotated); } if (checkCategorizedResources.Checked) { excVector.Add(Core.FilterRegistry.Std.ResourceIsCategorized); } if (checkUnreadResources.Checked) { excVector.Add(Core.FilterRegistry.Std.ResourceIsUnread); } //----------------------------------------------------------------- if (checkDeleteResources.Checked) { actVector.Add(Core.FilterRegistry.Std.DeleteResourceAction); } if (checkMarkRead.Checked) { actVector.Add(Core.FilterRegistry.Std.MarkResourceAsReadAction); } exceptions = (IResource[])excVector.ToArray(typeof(IResource)); actions = (IResource[])actVector.ToArray(typeof(IResource)); }
public IResource ParseTokenStream(string stream) { IResource condition = null; IResourceList categories = Core.ResourceStore.GetAllResources("Category"); IResource template = Core.FilterRegistry.Std.InTheCategoryX; if (template != null) { stream = stream.ToLower().Trim(); foreach (IResource res in categories.ValidResources) { if (res.GetStringProp(Core.Props.Name).ToLower() == stream) { condition = FilterConvertors.InstantiateTemplate(template, res.ToResourceList(), null); break; } } } return(condition); }
/** * Returns an array of rule actions currently checked in the dialog. */ private IResource[] BuildRuleActions() { ArrayList ruleActions = new ArrayList(); if (_chkShowDesktopAlert.Checked) { ruleActions.Add(Core.ResourceStore.FindUniqueResource(FilterManagerProps.RuleActionResName, "Name", "Show desktop alert")); } if (_chkPlaySound.Checked && _edtSoundName.Text != "") { IResource template = Core.ResourceStore.FindUniqueResource(FilterManagerProps.RuleActionTemplateResName, "Name", _playSoundTemplateName); ruleActions.Add(FilterConvertors.Template2Action(template, _edtSoundName.Text, null)); } if (_chkShowMessage.Checked && _edtMessage.Text != "") { IResource template = Core.ResourceStore.FindUniqueResource(FilterManagerProps.RuleActionTemplateResName, "Name", _showMessageTemplateName); ruleActions.Add(FilterConvertors.Template2Action(template, _edtMessage.Text, null)); } return((IResource[])ruleActions.ToArray(typeof(IResource))); }
void IViewsConstructor.RegisterViewsFirstRun() { string[] applType = new string[1] { "Task" }; IFilterRegistry fMgr = Core.FilterRegistry; IResourceTreeManager treeMgr = Core.ResourceTreeManager; IResource notStarted = fMgr.CreateStandardCondition(TaskNotStartedName, TaskNotStartedDeep, applType, "Status", ConditionOp.In, "0"); IResource inProgress = fMgr.CreateStandardCondition(TaskInProgressName, TaskInProgressDeep, applType, "Status", ConditionOp.In, "1"); IResource completed = fMgr.CreateStandardCondition(TaskIsCompletedName, TaskIsCompletedDeep, applType, "Status", ConditionOp.In, "2"); IResource notCompleted = fMgr.CreateStandardCondition(TaskIsNotCompletedName, TaskIsNotCompletedDeep, applType, "Status", ConditionOp.Lt, "2"); IResource overdue = fMgr.CreateStandardCondition(TaskIsOverdueName, TaskIsOverdueDeep, applType, "Date", ConditionOp.Lt, "Today"); IResource withReminder = fMgr.CreateStandardCondition(TaskHasReminderName, TaskHasReminderDeep, applType, "RemindDate", ConditionOp.HasProp); IResource remindDateRes = fMgr.CreateConditionTemplate(TaskReminderDatedName, TaskReminderDatedDeep, applType, ConditionOp.Eq, "RemindDate"); IResource dueToday = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "Today", applType); IResource dueTomorrow = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "Tomorrow", applType); IResource dueThisWeek = FilterConvertors.InstantiateTemplate(fMgr.Std.ReceivedInTheTimeSpanX, "This week", applType); fMgr.AssociateConditionWithGroup(notStarted, "Task Conditions"); fMgr.AssociateConditionWithGroup(inProgress, "Task Conditions"); fMgr.AssociateConditionWithGroup(completed, "Task Conditions"); fMgr.AssociateConditionWithGroup(notCompleted, "Task Conditions"); fMgr.AssociateConditionWithGroup(overdue, "Task Conditions"); fMgr.AssociateConditionWithGroup(withReminder, "Task Conditions"); fMgr.AssociateConditionWithGroup(remindDateRes, "Task Conditions"); IResource viewAll = fMgr.RegisterView("All Tasks", applType, (IResource[])null, null); IResource viewNotStarted = fMgr.RegisterView("Not Started", applType, new IResource[1] { notStarted }, null); IResource viewInProgress = fMgr.RegisterView("In Progress", applType, new IResource[1] { inProgress }, null); IResource viewCompleted = fMgr.RegisterView("Completed", applType, new IResource[1] { completed }, null); IResource viewOverdue = fMgr.RegisterView("Overdue", applType, new IResource[1] { overdue }, new IResource[1] { completed }); IResource viewDueToday = fMgr.RegisterView("Due Today", applType, new IResource[2] { dueToday, notCompleted }, null); IResource viewDueTomorrow = fMgr.RegisterView("Due Tomorrow", applType, new IResource[2] { dueTomorrow, notCompleted }, null); IResource viewDueThisWeek = fMgr.RegisterView("Due This Week", applType, new IResource[2] { dueThisWeek, notCompleted }, null); treeMgr.LinkToResourceRoot(viewAll, 1); treeMgr.LinkToResourceRoot(viewNotStarted, 2); treeMgr.LinkToResourceRoot(viewInProgress, 3); treeMgr.LinkToResourceRoot(viewCompleted, 4); treeMgr.LinkToResourceRoot(viewOverdue, 5); treeMgr.LinkToResourceRoot(viewDueToday, 6); treeMgr.LinkToResourceRoot(viewDueTomorrow, 7); treeMgr.LinkToResourceRoot(viewDueThisWeek, 8); viewAll.SetProp("DisableDefaultGroupping", true); viewNotStarted.SetProp("DisableDefaultGroupping", true); viewInProgress.SetProp("DisableDefaultGroupping", true); viewCompleted.SetProp("DisableDefaultGroupping", true); viewOverdue.SetProp("DisableDefaultGroupping", true); viewDueToday.SetProp("DisableDefaultGroupping", true); viewDueTomorrow.SetProp("DisableDefaultGroupping", true); viewDueThisWeek.SetProp("DisableDefaultGroupping", true); }
public IResource ParseTokenStream(string stream) { IResource condition = null; IResource template = Core.FilterRegistry.Std.ReceivedInTheTimeSpanX; if (template == null) // Everything is possible :-( { return(condition); } string propName = template.GetStringProp("ApplicableToProp"); stream = stream.ToLower().Trim(); if (stream == "." || stream == "today") { condition = FilterConvertors.InstantiateTemplate(template, "Today", null); } else if (stream == "..") { condition = FilterConvertors.InstantiateTemplate(template, "Yesterday", null); } else if (stream == "tw" || stream == "thisw" || stream == "this week") { condition = FilterConvertors.InstantiateTemplate(template, "This Week", null); } else if (stream == "lw" || stream == "lastw" || stream == "last week") { condition = FilterConvertors.InstantiateTemplate(template, "Last Week", null); } else { int indexInSet; string startDate, endDate; if (isMonthName(stream, out indexInSet)) { int monthNow = DateTime.Now.Month; if (monthNow == indexInSet) { condition = FilterConvertors.InstantiateTemplate(template, "This Month", null); } else { int yearNum = (monthNow < indexInSet) ? DateTime.Now.Year - 1 : DateTime.Now.Year; startDate = new DateTime(yearNum, indexInSet, 1).ToString(); endDate = new DateTime(yearNum, indexInSet, DateTime.DaysInMonth(yearNum, indexInSet)).ToString(); condition = ((FilterRegistry)Core.FilterRegistry).CreateStandardConditionAux( null, propName, ConditionOp.InRange, startDate, endDate); } } else if (isYearNumber(stream, out indexInSet)) { startDate = new DateTime(indexInSet, 1, 1).ToString(); endDate = new DateTime(indexInSet, 12, DateTime.DaysInMonth(indexInSet, 12)).ToString(); condition = ((FilterRegistry)Core.FilterRegistry).CreateStandardConditionAux( null, propName, ConditionOp.InRange, startDate, endDate); } } return(condition); }
public void RegisterViewsFirstRun() { //----------------------------------------------------------------- IFilterRegistry fMgr = Core.FilterRegistry; IStandardConditions std = fMgr.Std; //----------------------------------------------------------------- // Standard atomic conditions //----------------------------------------------------------------- IResource unr = fMgr.CreateStandardCondition(std.ResourceIsUnreadName, std.ResourceIsUnreadNameDeep, null, "IsUnread", ConditionOp.In, "true"); IResource fla = fMgr.CreateStandardCondition(std.ResourceIsFlaggedName, std.ResourceIsFlaggedNameDeep, null, "Flag", ConditionOp.HasLink); IResource ann = fMgr.CreateStandardCondition(std.ResourceIsAnnotatedName, std.ResourceIsAnnotatedNameDeep, null, "Annotation", ConditionOp.HasProp); IResource cli = fMgr.CreateStandardCondition(std.ResourceIsAClippingName, std.ResourceIsAClippingNameDeep, null, "IsClippingFakeProp", ConditionOp.HasProp); IResource del = fMgr.CreateStandardCondition(std.ResourceIsDeletedName, std.ResourceIsDeletedNameDeep, null, "IsDeleted", ConditionOp.HasProp); IResource foo = fMgr.CreateStandardCondition(FilterManagerStandards.DummyConditionName, FilterManagerStandards.DummyConditionName, null, "Id", ConditionOp.Gt, "0"); foo.SetProp("Invisible", true); //----------------------------------------------------------------- // Standard condition templates //----------------------------------------------------------------- fMgr.CreateConditionTemplate(std.ResourceIsFlaggedWithFlagXName, std.ResourceIsFlaggedWithFlagXNameDeep, null, ConditionOp.In, "Flag", "Flag"); fMgr.CreateConditionTemplate(std.SizeIsInTheIntervalXName, std.SizeIsInTheIntervalXNameDeep, null, ConditionOp.InRange, "Size", "0", Int32.MaxValue.ToString()); fMgr.CreateConditionTemplate(std.ResourceBelongsToWorkspaceXName, std.ResourceBelongsToWorkspaceXNameDeep, null, ConditionOp.In, "Workspace", "WorkspaceVisible"); IResource res; res = fMgr.CreateConditionTemplate(std.BodyMatchesSearchQueryXName, std.BodyMatchesSearchQueryXNameDeep, null, ConditionOp.QueryMatch); fMgr.AssociateConditionWithGroup(res, "Text Query Conditions"); res = fMgr.CreateConditionTemplate(std.SubjectMatchSearchQueryXName, std.SubjectMatchSearchQueryXNameDeep, null, ConditionOp.QueryMatch, DocumentSection.SubjectSection); fMgr.AssociateConditionWithGroup(res, "Text Query Conditions"); res = fMgr.CreateConditionTemplate(std.SourceMatchSearchQueryXName, std.SourceMatchSearchQueryXNameDeep, null, ConditionOp.QueryMatch, DocumentSection.SourceSection); fMgr.AssociateConditionWithGroup(res, "Text Query Conditions"); res = fMgr.CreateConditionTemplate(std.SubjectIsTextXName, std.SubjectIsTextXNameDeep, null, ConditionOp.Eq, "Subject"); fMgr.AssociateConditionWithGroup(res, "Text Query Conditions"); res = fMgr.CreateConditionTemplate(std.SubjectContainsTextXName, std.SubjectContainsTextXNameDeep, null, ConditionOp.Has, "Subject"); fMgr.AssociateConditionWithGroup(res, "Text Query Conditions"); res = fMgr.CreateConditionTemplate(std.FromContactXName, std.FromContactXNameDeep, null, ConditionOp.In, "Contact", "From"); fMgr.AssociateConditionWithGroup(res, "Address and Contact Conditions"); res = fMgr.CreateConditionTemplate(std.ToContactXName, std.ToContactXNameDeep, null, ConditionOp.In, "Contact", "To"); fMgr.AssociateConditionWithGroup(res, "Address and Contact Conditions"); res = fMgr.CreateConditionTemplate(std.CCContactXName, std.CCContactXNameDeep, null, ConditionOp.In, "Contact", "CC"); fMgr.AssociateConditionWithGroup(res, "Address and Contact Conditions"); res = fMgr.CreateConditionTemplate(std.InTheCategoryXName, std.InTheCategoryXNameDeep, null, ConditionOp.In, "Category", "Category"); fMgr.AssociateConditionWithGroup(res, "Category Conditions"); res = fMgr.CreateConditionTemplate(std.SenderIsInTheCategoryXName, std.SenderIsInTheCategoryXNameDeep, null, ConditionOp.In, "Category", "From>Category"); fMgr.AssociateConditionWithGroup(res, "Category Conditions"); res = fMgr.CreateStandardCondition(std.ReceivedAheadOfTodayName, std.ReceivedAheadOfTodayNameDeep, null, "Date", ConditionOp.Gt, "Tomorrow"); fMgr.AssociateConditionWithGroup(res, "Temporal Conditions"); res = fMgr.CreateConditionTemplate(std.DeletedInTheTimeSpanXName, std.DeletedInTheTimeSpanXNameDeep, null, ConditionOp.Eq, "DelDate"); fMgr.AssociateConditionWithGroup(res, "Temporal Conditions"); IResource dateRes = fMgr.CreateConditionTemplate(std.ReceivedInTheTimeSpanXName, std.ReceivedInTheTimeSpanXNameDeep, null, ConditionOp.Eq, "Date"); fMgr.AssociateConditionWithGroup(dateRes, "Temporal Conditions"); //----------------------------------------------------------------- // Standard conditions derived from standard templates //----------------------------------------------------------------- IResource todayCond = FilterConvertors.InstantiateTemplate(dateRes, "Today", null); IResource yesterdayCond = FilterConvertors.InstantiateTemplate(dateRes, "Yesterday", null); IResource thisWeekCond = FilterConvertors.InstantiateTemplate(dateRes, "This Week", null); IResource lastWeekCond = FilterConvertors.InstantiateTemplate(dateRes, "Last Week", null); IResource thisMonthCond = FilterConvertors.InstantiateTemplate(dateRes, "This Month", null); IResource lastMonthCond = FilterConvertors.InstantiateTemplate(dateRes, "Last Month", null); //----------------------------------------------------------------- // Standard views //----------------------------------------------------------------- IResource unreadRes = fMgr.RegisterView("Unread", new [] { unr }, null); IResource flaggedRes = fMgr.RegisterView("Flagged", new [] { fla }, null); IResource annotatedRes = fMgr.RegisterView("Annotated", new [] { ann }, null); IResource clippings = fMgr.RegisterView("Clippings", new [] { cli }, null); IResource deletedRes = fMgr.RegisterView("Deleted Resources", new [] { del }, null); deletedRes.SetProp(Core.Props.ShowDeletedItems, true); deletedRes.SetProp("IsLiveMode", true); IResource today = fMgr.RegisterView("Today", new [] { todayCond }, null); IResource yesterday = fMgr.RegisterView("Yesterday", new [] { yesterdayCond }, null); IResource thisWeek = fMgr.RegisterView("This week", new [] { thisWeekCond }, null); IResource lastWeek = fMgr.RegisterView("Last week", new [] { lastWeekCond }, null); IResource thisMonth = fMgr.RegisterView("This month", new [] { thisMonthCond }, null); IResource lastMonth = fMgr.RegisterView("Last month", new [] { lastMonthCond }, null); fMgr.SetVisibleInAllTabs(flaggedRes); fMgr.SetVisibleInAllTabs(annotatedRes); fMgr.SetVisibleInAllTabs(clippings); fMgr.SetVisibleInAllTabs(deletedRes); //----------------------------------------------------------------- Core.FilterRegistry.CreateViewFolder("Recent", null, 0); fMgr.AssociateViewWithFolder(unreadRes, null, 1); fMgr.AssociateViewWithFolder(deletedRes, null, 3); fMgr.AssociateViewWithFolder(flaggedRes, null, 4); fMgr.AssociateViewWithFolder(annotatedRes, null, 5); fMgr.AssociateViewWithFolder(clippings, null, 7); fMgr.AssociateViewWithFolder(today, "Recent", 0); fMgr.AssociateViewWithFolder(yesterday, "Recent", 1); fMgr.AssociateViewWithFolder(thisWeek, "Recent", 2); fMgr.AssociateViewWithFolder(lastWeek, "Recent", 3); fMgr.AssociateViewWithFolder(thisMonth, "Recent", 4); fMgr.AssociateViewWithFolder(lastMonth, "Recent", 5); //----------------------------------------------------------------- // By default make all these views "threaded" due to the new // possibilities to show attachments //----------------------------------------------------------------- today.SetProp(Core.Props.DisplayThreaded, true); yesterday.SetProp(Core.Props.DisplayThreaded, true); thisWeek.SetProp(Core.Props.DisplayThreaded, true); lastWeek.SetProp(Core.Props.DisplayThreaded, true); thisMonth.SetProp(Core.Props.DisplayThreaded, true); lastMonth.SetProp(Core.Props.DisplayThreaded, true); }