public void OnBeforeSave_Calls_DocumentLocator(
            [Frozen] IDocumentLocator locator,
            DocumentEventHandler sut,
            uint docCookie)
        {
            sut.OnBeforeSave(docCookie);

            locator
            .Received(1)
            .FindDocument(docCookie);
        }
        public void OnBeforeSave_Calls_DocumentFormatter(
            [Frozen] IDocumentLocator locator,
            [Frozen] IDocumentFormatter formatter,
            DocumentEventHandler sut,
            uint docCookie,
            Document document)
        {
            locator
            .FindDocument(docCookie)
            .Returns(document);

            sut.OnBeforeSave(docCookie);

            formatter
            .Received(1)
            .Format(document);
        }
Пример #3
0
        public bool AttachModelDocEventHandler(ModelDoc2 modDoc)
        {
            if (modDoc == null)
            {
                return(false);
            }

            DocumentEventHandler docHandler = null;

            if (!openDocs.Contains(modDoc))
            {
                switch (modDoc.GetType())
                {
                case (int)swDocumentTypes_e.swDocPART:
                {
                    docHandler = new PartEventHandler(modDoc, this);
                    break;
                }

                case (int)swDocumentTypes_e.swDocASSEMBLY:
                {
                    docHandler = new AssemblyEventHandler(modDoc, this);
                    break;
                }

                case (int)swDocumentTypes_e.swDocDRAWING:
                {
                    docHandler = new DrawingEventHandler(modDoc, this);
                    break;
                }

                default:
                {
                    return(false);        //Unsupported document type
                }
                }
                docHandler.AttachEventHandlers();
                openDocs.Add(modDoc, docHandler);
            }
            return(true);
        }
        protected override async Task InitializeAsync(
            CancellationToken cancellationToken,
            IProgress <ServiceProgressData> progress)
        {
            var dte = await GetServiceAsync(typeof(SDTE)) as DTE2;

            if (dte is null)
            {
                return;
            }

            var runningDocumentTable = new RunningDocumentTableWrapper(
                new RunningDocumentTable(this));

            var textFormatters = new ITextFormatter[]
            {
                new RemoveAndSortUsingsCommand(dte),
                new TrailingWhiteSpaceRemover(),
                new TrailingLineBreakRemover(),
            };

            var threadHelper    = new ThreadHelperWrapper();
            var documentLocator = new DocumentLocator(
                dte,
                runningDocumentTable,
                threadHelper);

            var documentFormatter = new DocumentFormatter(
                dte,
                new VsTextViewProvider(this),
                new UndoProvider(),
                threadHelper,
                textFormatters);

            var eventHandler = new DocumentEventHandler(
                documentLocator,
                documentFormatter);

            runningDocumentTable.Advise(eventHandler);
        }
Пример #5
0
 protected override void ExecuteApplicationSpecificStart()
 {
     ExWatson.Register("E12IIS");
     StoreSession.UseRPCContextPool = true;
     UMClientCommonBase.InitializePerformanceCounters(false);
     OwaEventRegistry.RegisterEnum(typeof(Importance));
     OwaEventRegistry.RegisterEnum(typeof(Sensitivity));
     OwaEventRegistry.RegisterEnum(typeof(AddressOrigin));
     OwaEventRegistry.RegisterEnum(typeof(FlagAction));
     OwaEventRegistry.RegisterEnum(typeof(TaskStatus));
     OwaEventRegistry.RegisterEnum(typeof(BusyType));
     OwaEventRegistry.RegisterEnum(typeof(ResponseType));
     OwaEventRegistry.RegisterEnum(typeof(StoreObjectType));
     OwaEventRegistry.RegisterEnum(typeof(EmailAddressIndex));
     OwaEventRegistry.RegisterEnum(typeof(NavigationNodeGroupSection));
     OwaEventRegistry.RegisterEnum(typeof(InstantMessagingTypeOptions));
     OwaEventRegistry.RegisterEnum(typeof(NavigationModule));
     OwaEventRegistry.RegisterEnum(typeof(DefaultFolderType));
     OwaEventRegistry.RegisterEnum(typeof(RecipientBlockType));
     OwaEventRegistry.RegisterEnum(typeof(RecipientJunkEmailContextMenuType));
     OwaEventRegistry.RegisterEnum(typeof(SharingLevel));
     OwaEventRegistry.RegisterEnum(typeof(DenyResponseType));
     OwaEventRegistry.RegisterEnum(typeof(AddressBookItemEventHandler.ItemTypeToPeople));
     OwaEventRegistry.RegisterStruct(typeof(RecipientInfo));
     OwaEventRegistry.RegisterStruct(typeof(DeleteItemInfo));
     OwaEventRegistry.RegisterStruct(typeof(ReminderInfo));
     OwaEventRegistry.RegisterHandler(typeof(ProxyEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(PendingRequestEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(ProxyToEwsEventHandler));
     NotificationEventHandler.Register();
     ClientCacheEventHandler.Register();
     DocumentLibraryEventHandler.Register();
     DocumentEventHandler.Register();
     DatePickerEventHandler.Register();
     ReadADOrgPersonEventHandler.Register();
     ListViewEventHandler.Register();
     TreeEventHandler.Register();
     NavigationEventHandler.Register();
     RecipientWellEventHandler.Register();
     AttachmentEventHandler.Register();
     ReadMessageEventHandler.Register();
     ReadConversationEventHandler.Register();
     ReadVoiceMessageEventHandler.Register();
     OptionsEventHandler.Register();
     AddressBookItemEventHandler.Register();
     OwaEventRegistry.RegisterHandler(typeof(EditMessageEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(EditSmsEventHandler));
     EditCalendarItemEventHandler.Register();
     CalendarViewEventHandler.Register();
     OwaEventRegistry.RegisterHandler(typeof(EditMeetingInviteEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(EditMeetingResponseEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(ErrorEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(FlagEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(CategoryEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(InstantMessageEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(MonitoringEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(MailTipsEventHandler));
     RemindersEventHandler.Register();
     EditContactItemEventHandler.Register();
     EditDistributionListEventHandler.Register();
     JunkEmailEventHandler.Register();
     EditTaskEventHandler.Register();
     ComplianceEventHandler.Register();
     WebReadyFileEventHandler.Register();
     EditPostEventHandler.Register();
     ReadPostEventHandler.Register();
     SMimeEventHandler.Register();
     NavigationNodeEventHandler.Register();
     MessageVirtualListViewEventHandler2.Register();
     TaskVirtualListViewEventHandler.Register();
     PersonalAutoAttendantOptionsEventHandler.Register();
     EditPAAEventHandler.Register();
     PerformanceConsoleEventHandler.Register();
     DirectoryVirtualListViewEventHandler.Register();
     ContactVirtualListViewEventHandler.Register();
     DumpsterVirtualListViewEventHandler.Register();
     SharingMessageEventHandler.Register();
     DeletePolicyEventHandler.Register();
     MovePolicyEventHandler.Register();
     PrintCalendarEventHandler.Register();
     MessageAnnotationEventHandler.Register();
 }
Пример #6
0
        private RibbonUpDown AddUpDown(RibbonItemCollection collection, string label, string msoImageName,
				DocumentEventHandler getValue, string suffix, decimal increment, decimal min = 0, decimal max = 100, EventHandler changed = null)
        {
            RibbonUpDown updown = new RibbonUpDown();
            updown.Text = label;
            updown.LabelWidth = 50;
            AssignImage(updown, msoImageName);
            decimal currentValue = 0;
            updown.TextBoxText = currentValue + suffix;
            updown.AllowTextEdit = true;
            updown.Enabled = true;
            updown.UpButtonClicked += new MouseEventHandler(delegate(object sender, MouseEventArgs e) {
                currentValue = Math.Min(currentValue + increment, max);
                updown.TextBoxText = currentValue + suffix;
            });
            updown.DownButtonClicked += new MouseEventHandler(delegate(object sender, MouseEventArgs e) {
                currentValue = Math.Max(currentValue - increment, min);
                updown.TextBoxText = currentValue + suffix;
            });
            m_WordInstance.Application.WindowActivate += new Word.ApplicationEvents4_WindowActivateEventHandler(delegate(Word.Document doc, Word.Window win) {
                currentValue = Math.Min(max, Math.Max(min, getValue(doc)));
                updown.TextBoxText = currentValue + suffix;
            });
            // TODO: Uncommenting this causes serious issues. Figure out later if necessary.
            //updown.TextBoxTextChanged += changed;
            collection.Add(updown);
            return updown;
        }