public TBuilder WithObjectProperties(object instance, Func <PropertyDescriptor, bool> propertyFilter) { var properties = TypeDescriptor.GetProperties(instance) .Cast <PropertyDescriptor>() .Where(x => x.IsBrowsable && propertyFilter(x)) .ToList(); // If any properties are not in the default group, show all properties in collapsible groups. if (properties.Any(x => !string.IsNullOrEmpty(x.Category) && x.Category != CategoryAttribute.Default.Category)) { foreach (var category in properties.GroupBy(x => x.Category)) { var actualCategory = (string.IsNullOrEmpty(category.Key) || category.Key == CategoryAttribute.Default.Category) ? "Miscellaneous" : category.Key; var collapsibleGroupBuilder = new CollapsibleGroupBuilder(); AddProperties(instance, category, collapsibleGroupBuilder.Inspectors); if (collapsibleGroupBuilder.Inspectors.Any()) { Inspectors.Add(collapsibleGroupBuilder.ToCollapsibleGroup(actualCategory)); } } } else // Otherwise, show properties in flat list. { AddProperties(instance, properties, Inspectors); } return((TBuilder)this); }
/// <summary> /// A method to retrieve all inspectors which can act as an export target /// </summary> /// <param name="allowMeetingAsTarget">bool true if also exporting to meetings</param> /// <returns>List<string> with inspector captions (window title)</returns> public static Dictionary <string, OlObjectClass> RetrievePossibleTargets(bool allowMeetingAsTarget) { Dictionary <string, OlObjectClass> inspectorCaptions = new Dictionary <string, OlObjectClass>(); try { using (IOutlookApplication outlookApplication = GetOutlookApplication()) { if (outlookApplication == null) { return(null); } using (Inspectors inspectors = outlookApplication.Inspectors) { if (inspectors != null && inspectors.Count > 0) { for (int i = 1; i <= inspectors.Count; i++) { using (Inspector inspector = outlookApplication.Inspectors[i]) { string inspectorCaption = inspector.Caption; using (Item currentItem = inspector.CurrentItem) { if (canExportToInspector(currentItem, allowMeetingAsTarget)) { OlObjectClass currentItemClass = currentItem.Class; inspectorCaptions.Add(inspector.Caption, currentItemClass); } } } } } } } } catch (Exception ex) { LOG.Warn("Problem retrieving word destinations, ignoring: ", ex); } return(inspectorCaptions); }
public void ExecuteAddCommand(object parameter) { Inspector ins = (from i in db.Inspectors where i.Number == NewInspector.Number select i).FirstOrDefault(); if (ins != null) { MessageBox.Show("Такой номер уже существует. Инспектор не добавлен"); } else { NewInspector.FirstName = NewInspector.FirstName.ToLower(); NewInspector.FirstName = NewInspector.FirstName.Substring(0, 1).ToUpper() + NewInspector.FirstName.Remove(0, 1); NewInspector.LastName = NewInspector.LastName.ToLower(); NewInspector.LastName = NewInspector.LastName.Substring(0, 1).ToUpper() + NewInspector.LastName.Remove(0, 1); NewInspector.MiddleName = NewInspector.MiddleName.ToLower(); NewInspector.MiddleName = NewInspector.MiddleName.Substring(0, 1).ToUpper() + NewInspector.MiddleName.Remove(0, 1); db.Inspectors.Add(NewInspector); db.SaveChanges(); MessageBox.Show("Инспектор добавлен"); Inspectors.Add(NewInspector); NewInspector = null; } }
void GetAllInspectors() { if (Inspectors == null) { Inspectors = new BindingList <InspectorViewType>(); } var foundInspectors = repos.InspectorRepo.GetAll(); if (foundInspectors != null) { foreach (Inspector i in foundInspectors) { Inspectors.Add(new InspectorViewType(i)); } } else { log.Warn("Setup settings: List of Inspectors is NULL."); } foreach (var insp in this.Inspectors) { // Due to incomplete the collection type matching returned at reading from the database and properties binding // the following solution have been proposed. Perhaps this problem can be solved by entities mapping. if (insp.Certificates.Count == 0) { insp.Certificates = new List <InspectorCertificate>(); } } Inspectors.ListChanged += (s, e) => ModifiableView.IsModified = true; }
private void ThisAddIn_Startup(object sender, EventArgs e) { this.safeDomains = new ArrayList(ConfigurationManager.AppSettings["safeDomains"].Split(',')); ArrayList userSafeDomains = new ArrayList(Properties.Settings.Default.safeDomains.Split(',')); this.safeDomains.AddRange(userSafeDomains); ctpWindowWrapper = new CTP_InspectorWrapper(); mailItemWindowWrapper = new MailItem_InspectorWrapper(); explorers = this.Application.Explorers; explorers.NewExplorer += Explorers_NewExplorer; Explorer currentExplorer = this.Application.ActiveExplorer(); currentExplorer.InlineResponse += CurrentExplorer_InlineResponse; currentExplorer.InlineResponseClose += CurrentExplorer_InlineResponseClose; ExplorerEvents_10_Event explorerEvents = currentExplorer; inspectors = this.Application.Inspectors; inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); this._explorersCount = this.explorers.Count; this.inlineResponseActive = false; this.anyInspectorActive = false; Application.ItemSend += Application_ItemSend; }
/// <summary> /// Export the image stored in tmpFile to the Inspector with the caption /// </summary> /// <param name="inspectorCaption">Caption of the inspector</param> /// <param name="tmpFile">Path to image file</param> /// <param name="attachmentName">name of the attachment (used as the tooltip of the image)</param> /// <returns>true if it worked</returns> public static bool ExportToInspector(string inspectorCaption, string tmpFile, string attachmentName) { // Assume true, although this might cause issues. bool allowMeetingAsTarget = true; using (IOutlookApplication outlookApplication = GetOrCreateOutlookApplication()) { if (outlookApplication != null) { Inspectors inspectors = outlookApplication.Inspectors; if (inspectors != null && inspectors.Count > 0) { LOG.DebugFormat("Got {0} inspectors to check", inspectors.Count); for (int i = 1; i <= inspectors.Count; i++) { Inspector inspector = outlookApplication.Inspectors[i]; string currentCaption = inspector.Caption; if (currentCaption.StartsWith(inspectorCaption)) { if (canExportToInspector(inspector, allowMeetingAsTarget)) { try { return(ExportToInspector(inspector, tmpFile, attachmentName)); } catch (Exception exExport) { LOG.Error("Export to " + currentCaption + " failed.", exExport); } } } } } } } return(false); }
private void MeetingInfoMain_Startup(object sender, System.EventArgs e) { ci = new CultureInfo(setting.Language); inspectors = this.Application.Inspectors; inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector); Explorers_NewExplorer(this.Application.ActiveExplorer()); explorers = this.Application.Explorers; explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(Explorers_NewExplorer); labels = new Dictionary <int, ElementWrapper>() { { 0, _ribbon.Label1 }, { 1, _ribbon.Label2 }, { 2, _ribbon.Label3 }, { 3, _ribbon.Label4 }, { 4, _ribbon.DirectAccept }, }; DPrint("Assembly full name:\n " + typeof(MeetingInfoMain).Assembly.FullName, 2); DPrint("Assembly qualified name:\n " + typeof(MeetingInfoMain).AssemblyQualifiedName, 2); }
/// <summary> /// A method to retrieve all inspectors which can act as an export target /// </summary> /// <param name="outlookApplication">IOutlookApplication</param> /// <returns>List<string> with inspector captions (window title)</returns> private static List <string> RetrievePossibleTargets(IOutlookApplication outlookApplication) { List <string> possibleTargets = new List <string>(); Inspectors inspectors = outlookApplication.Inspectors; if (inspectors != null && inspectors.Count > 0) { LOG.DebugFormat("Got {0} inspectors to check", inspectors.Count); for (int i = 1; i <= inspectors.Count; i++) { Inspector inspector = outlookApplication.Inspectors[i]; LOG.DebugFormat("Checking inspector '{0}'", inspector.Caption); try { Item currentMail = inspector.CurrentItem; if (currentMail != null && OlObjectClass.olMail.Equals(currentMail.Class)) { if (currentMail != null && !currentMail.Sent) { possibleTargets.Add(inspector.Caption); } } } catch (Exception) { } } } return(possibleTargets); }
public void NotifyInspectorEdited(Gebruiker gebruiker) { Inspectors.Remove(Inspectors.FirstOrDefault(k => k.Id == gebruiker.Id)); Inspectors.Add(new GebruikerVM(gebruiker)); edit.Close(); edit = null; }
public void Dispose() { explorers.NewExplorer -= NewExplorer; inspectors.NewInspector -= NewInspector; explorers.ReleaseComObject(); inspectors.ReleaseComObject(); explorers = null; inspectors = null; }
public TBuilder WithEditor <T, TProperty, TEditor>(T instance, Expression <Func <T, TProperty> > propertyExpression, TEditor editor) where TEditor : IEditor { var propertyName = KSoft.Reflection.Util.PropertyNameFromExpr(propertyExpression); editor.BoundPropertyDescriptor = BoundPropertyDescriptor.FromProperty(instance, propertyName); Inspectors.Add(editor); return((TBuilder)this); }
private void ThisAddIn_Shutdown(object sender, EventArgs e) { inspectors.NewInspector -= NewInspector; inspectors = null; InspectorWrappers = null; explorers.NewExplorer -= NewExplorer; explorers = null; ExplorerWrappers = null; }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { inspectors = Application.Inspectors; spamFolder = this.Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderJunk); deletedFolder = this.Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderDeletedItems); sentFolder = this.Application.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderSentMail); int languageCode = this.Application.LanguageSettings.LanguageID[MsoAppLanguageID.msoLanguageIDUI]; language = LanguageHelper.ParseLanguage(languageCode); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { MyTaskPane pane = new MyTaskPane(); var taskPane = this.CustomTaskPanes.Add(pane, "My Custom Task Pane"); taskPane.Visible = true; _inspectors = Application.Inspectors; _inspectors.NewInspector += Inspectors_NewInspector; }
public override void Arrange() { _managerMock = new Mock <ILogManager>(); _inspectors = new Inspectors { Inspector1 = new Inspector1(), Inspector3 = new Inspector3(), Inspector4 = new Inspector4() }; base.Arrange(); }
private void Remove() { if (SelectedRemoveEmployee == null) { return; } Inspectors.Add(SelectedRemoveEmployee); SelectedInspectors.Remove(SelectedRemoveEmployee); SelectedRemoveEmployee = null; }
public TBuilder WithObjectProperty(object instance, PropertyDescriptor property) { var editor = DefaultPropertyInspectors.CreateEditor(property); if (editor != null) { editor.BoundPropertyDescriptor = new BoundPropertyDescriptor(instance, property); Inspectors.Add(editor); } return((TBuilder)this); }
protected override void Seed(UserContext db) { Inspectors firstinspector = new Inspectors(Guid.NewGuid(), "Иванов А.А.", 145698); db.Inspectors.Add(firstinspector); Inspections firstinspection = new Inspections(Guid.NewGuid(), "Пожарная инспекция", firstinspector.ID, DateTime.Today, "Комментариев нет"); db.Inspections.Add(firstinspection); db.Notices.Add(new Notices(Guid.NewGuid(), "Первое замечание", DateTime.Today, "Комментариев нет", firstinspection.ID)); db.Notices.Add(new Notices(Guid.NewGuid(), "Второе замечание", DateTime.Today, "Комментариев нет", firstinspection.ID)); db.SaveChanges(); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { HasConfig = !String.IsNullOrWhiteSpace(Configuration.ReportRecipient); _explorers = Application.Explorers; _explorers.NewExplorer += new ExplorersEvents_NewExplorerEventHandler(NewExplorer); _inspectors = Application.Inspectors; _inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(NewInspector); _currentExplorer = this.Application.ActiveExplorer(); _currentExplorer.SelectionChange += new ExplorerEvents_10_SelectionChangeEventHandler(Explorer_SelectionChange); }
public void Dispose() { if (_wsInspectors != null) { foreach (var inspector in _wsInspectors) { inspector.Dispose(); } _wsInspectors.Clear(); _wsInspectors = null; } if (_inspectors != null) { Marshal.ReleaseComObject(_inspectors); _inspectors = null; } }
private void CreateInspectorForRow(InspectorTypes type, VarRef var, int row) { UserControl control = Inspectors.CreateInspector(type, var); switch (type) { case InspectorTypes.kMatrix4x4: Grid.SetRowSpan(control, 4); break; case InspectorTypes.kMatrix3x3: Grid.SetRowSpan(control, 3); break; } Grid.SetRow(control, row); Grid.SetColumn(control, 1); grid1.Children.Add(control); }
public override void OnEnter() { if (ViewBag?.Task == null) { MessageBox.Show("Er is geen inspectie geselecteerd!"); _router.GoBack(); return; } Task = ViewBag.Task; Inspections.Clear(); Task.Inspections.ToList().ForEach(Inspections.Add); Inspectors.Clear(); Task.Inspections.SelectMany(x => x.InspectionInspectors.Select(i => i.Employee)).Distinct().ToList().ForEach(Inspectors.Add); Remarks = Task.Remarks; RaisePropertyChanged(nameof(Task)); }
private void ThisAddIn_Startup(object sender, EventArgs e) { InspectorWrappers = new Dictionary <Inspector, InspectorWrapper>(); ExplorerWrappers = new Dictionary <Explorer, ExplorerWrapper>(); inspectors = Application.Inspectors; inspectors.NewInspector += NewInspector; foreach (Inspector inspector in inspectors) { NewInspector(inspector); } explorers = Application.Explorers; explorers.NewExplorer += NewExplorer; foreach (Explorer explorer in explorers) { NewExplorer(explorer); } }
private void ThisAddIn_Startup(object sender, EventArgs e) { InspectorWrappers = new Dictionary<Inspector, InspectorWrapper>(); ExplorerWrappers = new Dictionary<Explorer, ExplorerWrapper>(); inspectors = Application.Inspectors; inspectors.NewInspector += NewInspector; foreach (Inspector inspector in inspectors) { NewInspector(inspector); } explorers = Application.Explorers; explorers.NewExplorer += NewExplorer; foreach (Explorer explorer in explorers) { NewExplorer(explorer); } }
public void Init() { using (var con = new UserContext()) { var i = con.InspectionNames.Select(x => new { Id = x.Id, Name = x.Name }).AsEnumerable().Select(y => new InspectionName { Id = y.Id, Name = y.Name }).ToList(); InspectionNames = i.ToObservableCollection(); } using (var con = new UserContext()) { var i = con.RemarkNames.Select(x => new { Id = x.Id, Name = x.Name }).AsEnumerable().Select(y => new RemarkName { Id = y.Id, Name = y.Name }).ToList(); RemarkNames = i.ToObservableCollection(); } if (Inspection == null) { Inspection = new Inspection() { InspectionName = InspectionNames.FirstOrDefault(), Remarks = new ObservableCollection <Remark>(), Inspector = Inspectors.FirstOrDefault() }; } SelectedRemark = new Remark(); }
/// <summary> /// Export to currently opened Email /// </summary> /// <param name="activeInspector"></param> private static bool ExportToOpenEmail(IOutlookApplication outlookApplication, string tmpFile, string subject) { using (Inspector activeInspector = outlookApplication.ActiveInspector()) { if (activeInspector != null) { try { LOG.DebugFormat("Checking active inspector '{0}'", activeInspector.Caption); if (ExportToInspector(activeInspector, tmpFile, subject)) { return(true); } } catch (Exception ex) { LOG.DebugFormat("Problem exporting to activeinspector: {0}", ex.Message); } } } Inspectors inspectors = outlookApplication.Inspectors; if (inspectors != null && inspectors.Count > 0) { LOG.DebugFormat("Got {0} inspectors to check", inspectors.Count); for (int i = 1; i <= inspectors.Count; i++) { Inspector inspector = outlookApplication.Inspectors[i]; LOG.DebugFormat("Checking inspector '{0}'", inspector.Caption); try { bool exported = ExportToInspector(inspector, tmpFile, subject); if (exported) { return(true); } } catch (Exception ex) { LOG.DebugFormat("Problem exporting to inspector: {0}", ex.Message); } } } return(false); }
/// <summary> /// /// </summary> /// <param name="outlookApplication"></param> public OutlookViewProvider(_Application outlookApplication) { explorers = outlookApplication.Explorers; inspectors = outlookApplication.Inspectors; }
private void Disty_Startup(object sender, System.EventArgs e) { inspectors = this.Application.Inspectors; inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Target); }
private void ThisAddInShutdown(object sender, EventArgs e) { const string SOURCE = CLASS_NAME + "Shutdown"; try { //clean up wrappers if (_inspWrappers != null) { Logger.Verbose(SOURCE, string.Format( "releasing {0} inspector wrappers", _inspWrappers.Count)); var keys = new string[_inspWrappers.Count]; _inspWrappers.Keys.CopyTo(keys, 0); foreach (var key in keys) _inspWrappers.Remove(key); } if (_explWrappers != null) { Logger.Verbose(SOURCE, string.Format( "releasing {0} explorer wrappers", _explWrappers.Count)); var keys = new string[_explWrappers.Count]; _explWrappers.Keys.CopyTo(keys, 0); foreach (var key in keys) _explWrappers.Remove(key); } if (_searchFolderWrappers != null && _searchFolderWrappers.Count > 0) { var keys = new string[_searchFolderWrappers.Count]; _searchFolderWrappers.Keys.CopyTo(keys, 0); foreach (var key in keys) _searchFolderWrappers.Remove(key); { } } //release Inspectors & Explorers which will release handlers Inspectors = null; Explorers = null; //clean the temp directory Logger.Verbose(SOURCE, "cleaning temp folder"); Utils.CleanTempFolder(""); } catch (Exception ex) { Logger.Error(SOURCE, ex.ToString()); } }
private void ThisAddInStartup(object sender, EventArgs e) { const string SOURCE = CLASS_NAME + "Startup"; try { Stopwatch swStartUpTime = new Stopwatch(); swStartUpTime.Start(); Logger.Init(); var version = Application.Version; AppVersion = Convert.ToInt32(version.Split(new[] { '.' })[0]); Logger.Info(SOURCE, string.Format("{0}Assembly version: {1}{0}Install path: {2}{0}" + "OS: {3} ({4}){0}Outlook version: {5} {6}{0}Profile: {9}{0}Framework version: {7}{0}IE version: {8}", Environment.NewLine, Assembly.GetExecutingAssembly().FullName, Utils.GetRootPath(), Environment.OSVersion, Environment.Is64BitOperatingSystem ? "x64" : "x86", version, Environment.Is64BitProcess ? "64-bit" : "", RuntimeEnvironment.GetSystemVersion(), Utils.GetBrowserVersion(), Session.CurrentProfileName)); //read the stored settings first var gotStored = GetStoredSettings(); //add new mail handler Application.NewMailEx += ApplicationNewMailEx; _inspWrappers = new Dictionary<string, InspWrap>(); _explWrappers = new Dictionary<string, ExplWrap>(); Inspectors = Application.Inspectors; #region Commented below code as it takes more time to make Outlook ready if we have more mails in selected folder (Inbox) Explorers = Application.Explorers; _items = Application.ActiveExplorer().CurrentFolder.Items; lstFolderIds.Add(Application.ActiveExplorer().CurrentFolder.EntryID); _items.ItemRemove += Items_ItemRemove; Application.ActiveExplorer().BeforeFolderSwitch += ThisAddIn_BeforeFolderSwitch; if (Explorers.Count > 0) { //may not be an ActiveExplorer on restart after a crash Explorer active; try { active = Application.ActiveExplorer(); } catch { active = null; } if (active == null) { Logger.Info(SOURCE, "no ActiveExplorer"); } else { AddWrapper(Application.ActiveExplorer()); } } #endregion //finish initialization in background, so we can exit startup immediately ThreadPool.QueueUserWorkItem(InitHandler, gotStored); ////load the current accounts //ValidateAccountsRdo(); //Logger.Verbose(SOURCE, string.Format( // "found {0} accounts", Accounts.Count)); ////read the stored settings //GetStoredSettings(); //Logger.Verbose(SOURCE, string.Format( // "active accounts: {0}", // ListCurrentAccounts())); //EvalAttachmentPreview(); ////CheckRegistrations(); Logger.Info(SOURCE, string.Format("Takes {0} seconds", swStartUpTime.Elapsed.TotalSeconds)); } catch (Exception ex) { Logger.Error(SOURCE, ex.ToString()); } }
public void DeleteInspector() { _providerItem.dataServer.DeleteInspector(SelectedInspector.GebruikerModel); Inspectors.Remove(SelectedInspector); }
public void Ribbon1_Load(object sender, RibbonUIEventArgs e) { inspectors = Globals.ThisAddIn.Application.Inspectors; }
public OutlookItemChangeWatcher (Inspectors inspectors) { inspectors.NewInspector += Inspectors_NewInspector; }
public void NotifyInspectorAdded(GebruikerVM gebruiker) { Inspectors.Add(gebruiker); _addInspectorWindow.Close(); _addInspectorWindow = null; }
public WsInspectors(Inspectors inspectors) { _inspectors = inspectors; _inspectors.NewInspector += OnNewInspector; }
public OutlookItemChangeWatcher(Inspectors inspectors) { inspectors.NewInspector += Inspectors_NewInspector; }