/// <summary>Initializes a new instance of the <see cref="EditorSettingsParameters"/> class.</summary>
 /// <param name="factory">The view model factory.</param>
 /// <param name="categories">The list of settings categories.</param>
 /// <param name="pluginsList">The list of plug ins for the fixed plugin list category.</param>
 /// <param name="messageDisplay">The message display service.</param>
 /// <param name="busyService">The busy state service.</param>
 /// <exception cref="ArgumentNullException">Thrown when any parameter is <b>null</b>.</exception>
 public EditorSettingsParameters(IEnumerable <ISettingsCategoryViewModel> categories, ISettingsPlugInsList pluginsList, IMessageDisplayService messageDisplay, IBusyStateService busyService)
 {
     MessageDisplay = messageDisplay ?? throw new ArgumentNullException(nameof(messageDisplay));
     Categories     = categories ?? throw new ArgumentNullException(nameof(categories));
     PlugInsList    = pluginsList ?? throw new ArgumentNullException(nameof(pluginsList));
     BusyService    = busyService ?? throw new ArgumentNullException(nameof(busyService));
 }
Beispiel #2
0
            public override void Execute()
            {
                IMessageDisplayService service = this.services.GetService <IMessageDisplayService>();
                SceneView sceneView            = (SceneView)this.services.GetService <IViewService>().ActiveView;

                if (sceneView != null)
                {
                    ViewNodeManager viewNodeManager = sceneView.InstanceBuilderContext.ViewNodeManager;
                    if (viewNodeManager == null || viewNodeManager.Root == null)
                    {
                        return;
                    }
                    StringBuilder sb            = new StringBuilder();
                    XmlTextWriter xmlTextWriter = new XmlTextWriter((TextWriter) new StringWriter(sb));
                    xmlTextWriter.Indentation = 4;
                    xmlTextWriter.Formatting  = Formatting.Indented;
                    this.DumpViewNodeTree(viewNodeManager.Root, (XmlWriter)xmlTextWriter);
                    xmlTextWriter.Flush();
                    Dump.Write(sb.ToString());
                }
                else
                {
                    service.ShowError("No Active Scene");
                }
            }
Beispiel #3
0
        public static void SaveLogAndPromptUser(ProjectUpgradeLogger upgradeLogger, IServiceProvider serviceProvider, string basePath, bool success)
        {
            if (upgradeLogger.IsEmpty)
            {
                return;
            }
            string str = UpgradeWizard.SafelyCreateLogFileWithFallback(upgradeLogger, basePath);

            if (string.IsNullOrEmpty(str))
            {
                return;
            }
            success = success & !upgradeLogger.HasErrors;
            if (!success)
            {
                IMessageDisplayService service        = (IMessageDisplayService)serviceProvider.GetService(typeof(IMessageDisplayService));
                MessageBoxArgs         messageBoxArg  = new MessageBoxArgs();
                CultureInfo            currentCulture = CultureInfo.CurrentCulture;
                string   upgradeErrorsMessage         = StringTable.UpgradeErrorsMessage;
                object[] objArray = new object[] { basePath };
                messageBoxArg.Message          = string.Format(currentCulture, upgradeErrorsMessage, objArray);
                messageBoxArg.HyperlinkMessage = StringTable.UpgradeErrorsLinkMessage;
                messageBoxArg.HyperlinkUri     = new Uri(str, UriKind.Absolute);
                messageBoxArg.Button           = MessageBoxButton.OK;
                messageBoxArg.Image            = MessageBoxImage.Hand;
                messageBoxArg.AutomationId     = "UpgradeWarningDialog";
                service.ShowMessage(messageBoxArg);
            }
        }
        public ConfigureSampleDataDialog(DataSchemaNodePath schemaPath, IMessageDisplayService messageService)
        {
            this.Title      = StringTable.SampleDataConfigurationDialogTitle;
            this.MinWidth   = ConfigureSampleDataDialog.dialogSize.Width;
            this.MinHeight  = ConfigureSampleDataDialog.dialogSize.Height;
            this.Height     = ConfigureSampleDataDialog.dialogSize.Height;
            this.Width      = ConfigureSampleDataDialog.dialogSize.Width;
            this.ResizeMode = ResizeMode.CanResize;
            this.Model      = new SampleDataEditorModel(schemaPath, messageService);
            FrameworkElement element = Microsoft.Expression.DesignSurface.FileTable.GetElement("Resources\\DataPane\\ConfigureSampleDataDialog.xaml");

            this.DialogContent            = (UIElement)element;
            this.sampleDataGrid           = (DataGrid)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "SampleDataGrid");
            this.rowsSlider               = (NumberEditor)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "RowsSlider");
            this.acceptButton             = (Button)LogicalTreeHelper.FindLogicalNode((DependencyObject)element, "AcceptButton");
            this.rowsSlider.KeyDown      += new KeyEventHandler(this.HandleEnterPressOnRowsSlider);
            this.sampleDataGrid.GotFocus += new RoutedEventHandler(this.sampleDataGrid_GotFocus);
            if (this.sampleDataGrid != null)
            {
                this.Columns = (IList <SampleDataDialogColumn>) new List <SampleDataDialogColumn>();
                foreach (SampleDataProperty property in (IEnumerable <SampleDataProperty>) this.Model.SampleDataProperties)
                {
                    SampleDataDialogColumn column = new SampleDataDialogColumn(property, this);
                    this.Columns.Add(column);
                    this.StyleColumnHeader(column);
                    this.sampleDataGrid.Columns.Add((DataGridColumn)column);
                }
            }
            element.DataContext = (object)this.Model;
        }
        public ConfiguratorViewModel(IApplicationLogger logger, IEventAggregator events, IApplicationCommands commands,
                                     ITemplateManager templateManager, IDriveDetector driveDetector, IMessageDisplayService messageService,
                                     ElementViewModelFactory elementFactory, IConfiguratorService configurator, IVariableStore variables)
        {
            _logger          = logger;
            _templateManager = templateManager;
            _driveDetector   = driveDetector;
            _messageService  = messageService;
            _elementFactory  = elementFactory;
            _configurator    = configurator;
            _variables       = variables;

            Title = "Configurator";

            events.GetEvent <TemplateSelectedEvent>().Subscribe(OnTemplateSelected);
            events.GetEvent <ScanDrivesCompletedEvent>().Subscribe(OnScanDrivesCompleted);

            ImportCommand = new DelegateCommand(OnImport, () => true);
            commands.ImportCommand.RegisterCommand(ImportCommand);

            PrevPageCommand = new DelegateCommand <PageViewModel>(OnPrevPage, CanPrevPage);
            NextPageCommand = new DelegateCommand <PageViewModel>(OnNextPage, page => true);
            RescanCommand   = new DelegateCommand(OnScanDrives, () => !IsScanning);

            RescanCommand.Execute();
        }
Beispiel #6
0
        protected override void PerformFinalActionsBeforeWatsonDump()
        {
            if (this.ExpressionInformationService == null)
            {
                return;
            }
            MessageBoxArgs args = new MessageBoxArgs()
            {
                Message = StringTable.ApplicationUnrecoverableErrorDialogMessage,
                Button  = MessageBoxButton.YesNo,
                Image   = MessageBoxImage.Hand
            };
            MessageBoxResult       messageBoxResult = MessageBoxResult.No;
            IMessageDisplayService service1         = this.Services.GetService <IMessageDisplayService>();

            if (service1 != null)
            {
                messageBoxResult = service1.ShowMessage(args);
            }
            IProjectManager service2 = this.Services.GetService <IProjectManager>();
            IViewService    service3 = this.Services.GetService <IViewService>();

            if (service3 != null)
            {
                foreach (IView view in (IEnumerable <IView>)service3.Views)
                {
                    SilverlightSceneView silverlightSceneView = view as SilverlightSceneView;
                    if (silverlightSceneView != null)
                    {
                        silverlightSceneView.SuspendUpdatesForViewShutdown();
                    }
                }
            }
            if (service2 == null || service2.CurrentSolution == null)
            {
                return;
            }
            bool flag = false;

            foreach (IProject project in service2.CurrentSolution.Projects)
            {
                foreach (IProjectItem projectItem in (IEnumerable <IProjectItem>)project.Items)
                {
                    if (projectItem.IsDirty)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    break;
                }
            }
            if (!flag || messageBoxResult != MessageBoxResult.Yes)
            {
                return;
            }
            service2.CurrentSolution.Save(false);
        }
Beispiel #7
0
                public bool AddMethod(Type returnType, string methodName, IEnumerable <IParameterDeclaration> parameters)
                {
                    CodeModelService.VisualStudioCodeModelService.MessageFilterTypeDeclaration.AddHandlerImplementation handlerImplementation = new CodeModelService.VisualStudioCodeModelService.MessageFilterTypeDeclaration.AddHandlerImplementation(this.services.GetService <IExpressionInformationService>(), this.typeDeclaration, returnType, methodName, parameters);
                    handlerImplementation.Execute();
                    Exception exception = handlerImplementation.Exception;

                    if (exception == null)
                    {
                        return(true);
                    }
                    bool         flag         = false;
                    COMException comException = exception as COMException;

                    if (comException != null && comException.ErrorCode == -2147221492)
                    {
                        flag = true;
                    }
                    IMessageDisplayService service = this.services.GetService <IMessageDisplayService>();

                    if (service != null)
                    {
                        if (flag)
                        {
                            service.ShowError(StringTable.EventHandlerCommunicatingWithVSTerminatedDialogMessage);
                        }
                        else
                        {
                            service.ShowError(StringTable.EventHandlerChangeFailedDialogMessage, exception, (string)null);
                        }
                    }
                    return(false);
                }
Beispiel #8
0
        public WorkspaceService(IConfigurationObject configurationObject, string workspacesPath, IEnumerable <string> factoryWorkspaceNames, IEnumerable <Uri> factoryWorkspaceConfigResources, IMessageDisplayService messageDisplayService)
        {
            this.configurationObject   = configurationObject;
            this.messageDisplayService = messageDisplayService;
            this.workspacesPath        = workspacesPath;
            this.CreateWorkspacesFolder(workspacesPath);
            int num = 0;

            foreach (string str in factoryWorkspaceNames)
            {
                string workspaceName = WorkspaceService.StripUnderscore(str);
                this.factoryWorkspaceNames.Add(workspaceName);
                this.AddCommand("Windows_Workspace_" + num.ToString((IFormatProvider)CultureInfo.InvariantCulture), (ICommand) new WorkspaceService.ActivateWorkspaceCommand(this, workspaceName, str));
                ++num;
            }
            this.factoryWorkspaceConfigResources.AddRange(factoryWorkspaceConfigResources);
            for (int index = 0; index < 10; ++index)
            {
                this.AddCommand("Windows_CustomWorkspace_" + index.ToString((IFormatProvider)CultureInfo.InvariantCulture), (ICommand) new WorkspaceService.ActivateCustomWorkspaceCommand(this, index));
            }
            this.AddCommand("Windows_ResetWorkspace", (ICommand) new WorkspaceService.ResetActiveWorkspaceCommand(this));
            this.AddCommand("Windows_SaveAsNewWorkspace", (ICommand) new WorkspaceService.SaveAsNewWorkspaceCommand(this));
            this.AddCommand("Windows_ManageWorkspaces", (ICommand) new WorkspaceService.ManageWorkspacesCommand(this, this.messageDisplayService));
            this.AddCommand("Windows_ToggleWorkspacePalettes", (ICommand) new WorkspaceService.ToggleWorkspacePalettesCommand());
            this.AddCommand("Windows_CycleWorkspace", (ICommand) new WorkspaceService.CycleWorkspaceCommand(this));
            this.AddCommand("Windows_AllWorkspaces", (ICommand) new WorkspaceService.MoreWorkspacesCommand(this));
        }
Beispiel #9
0
        public bool Execute()
        {
            this.SetRunning(true);
            Process process = null;

            System.Diagnostics.ProcessStartInfo processStartInfo = this.ProcessStartInfo;
            if (processStartInfo != null)
            {
                try
                {
                    process = Process.Start(processStartInfo);
                }
                catch (Win32Exception win32Exception1)
                {
                    Win32Exception         win32Exception            = win32Exception1;
                    IMessageDisplayService messageDisplayService     = base.Services.MessageDisplayService();
                    CultureInfo            currentCulture            = CultureInfo.CurrentCulture;
                    string   projectBuilderLaunchFailedDialogMessage = StringTable.ProjectBuilderLaunchFailedDialogMessage;
                    object[] fileName = new object[] { processStartInfo.FileName, win32Exception.ToString() };
                    messageDisplayService.ShowError(string.Format(currentCulture, projectBuilderLaunchFailedDialogMessage, fileName));
                }
            }
            if (process == null || process.HasExited)
            {
                this.SetRunning(false);
            }
            else
            {
                process.EnableRaisingEvents = true;
                process.Exited += new EventHandler(this.Process_Exited);
            }
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ProjectRun);
            return(process != null);
        }
Beispiel #10
0
        public static bool Navigate(Uri uri, IMessageDisplayService messageDisplayService)
        {
            bool flag;

            try
            {
                Process.Start(uri.OriginalString);
                return(true);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (!(exception is ObjectDisposedException) && !(exception is Win32Exception) && !(exception is ArgumentException) && !(exception is InvalidOperationException))
                {
                    throw;
                }
                if (messageDisplayService != null)
                {
                    CultureInfo currentCulture             = CultureInfo.CurrentCulture;
                    string      webNavigationFailedMessage = StringTable.WebNavigationFailedMessage;
                    object[]    originalString             = new object[] { uri.OriginalString };
                    messageDisplayService.ShowError(string.Format(currentCulture, webNavigationFailedMessage, originalString));
                }
                flag = false;
            }
            return(flag);
        }
        public SampleDataEditorModel(DataSchemaNodePath schemaPath, IMessageDisplayService messageService)
        {
            this.messageService = messageService;
            SampleType     sampleType         = schemaPath.Node.SampleType;
            DataSchemaNode collectionItemNode = schemaPath.EffectiveCollectionItemNode;

            this.editingSchemaPath    = new DataSchemaNodePath(schemaPath.Schema, collectionItemNode.Parent);
            this.sampleCompositeType  = (SampleCompositeType)collectionItemNode.SampleType;
            this.ValueBuilder         = new SampleDataValueBuilderBase(this.SampleDataSet, this.SampleDataSet.RootNode.Context);
            this.SampleDataProperties = (IList <SampleDataProperty>) new List <SampleDataProperty>();
            foreach (SampleProperty sampleProperty in (IEnumerable <SampleProperty>) this.sampleCompositeType.SampleProperties)
            {
                if (sampleProperty.IsBasicType)
                {
                    this.SampleDataProperties.Add(new SampleDataProperty(sampleProperty, this));
                }
            }
            ((List <SampleDataProperty>) this.SampleDataProperties).Sort((Comparison <SampleDataProperty>)((a, b) => StringLogicalComparer.Instance.Compare(a.SampleProperty.Name, b.SampleProperty.Name)));
            this.sourceCollectionNode = this.GetCollectionNode(this.SampleDataSet.RootNode, false);
            this.ValueBuilder.InitCollectionDepth(this.editingSchemaPath);
            List <SampleDataRow> rows = new List <SampleDataRow>();

            if (this.sourceCollectionNode != null)
            {
                int count = this.sourceCollectionNode.Children.Count;
                for (int rowNumber = 0; rowNumber < count; ++rowNumber)
                {
                    rows.Add(new SampleDataRow(this, rowNumber));
                }
            }
            this.SampleDataRows = (ObservableCollection <SampleDataRow>) new SampleDataEditorModel.SampleDataRowCollection(rows);
        }
            public DataPaneCallback(DataSchemaItem dataSchemaItem)
            {
                DataSchemaNode node = dataSchemaItem.DataSchemaNodePath.Node;

                this.property       = ((SampleCompositeType)node.Parent.SampleType).GetSampleProperty(node.PathName);
                this.configuration  = new SampleDataPropertyConfiguration(this.property);
                this.messageService = dataSchemaItem.ViewModel.DesignerContext.MessageDisplayService;
            }
Beispiel #13
0
        public MessageWindowDialog(IMessageDisplayService messageDisplayService)
        {
            Version version = base.GetType().Assembly.GetName().Version;
            Uri     uri     = new Uri(string.Concat("/Shopdrawing.Controls", ";component/MessageBox/UserControl1.xaml"), UriKind.Relative);

            Application.LoadComponent(this, uri);
            this.messageDisplayService = messageDisplayService;
        }
        public BlendDocumentService(ICommandService commandService, IMessageDisplayService messageDisplayService)
            : base(commandService, messageDisplayService)
        {
            string commandName = "Application_FileClose";

            this.RemoveCommand(commandName);
            this.AddCommand(commandName, (ICommand) new BlendDocumentService.CloseFileByClosingViewCommand(this, messageDisplayService));
        }
        public static void DisplayCommandFailedMessage(this IProjectCommand source, string failureMessage)
        {
            IMessageDisplayService messageDisplayService = source.Services.MessageDisplayService();

            if (messageDisplayService != null)
            {
                messageDisplayService.ShowError(failureMessage);
            }
        }
Beispiel #16
0
 public ImportManager(IImporterService importService, IPrototypingService prototypingService, IMessageDisplayService messageDisplayService)
 {
     this.importService         = importService;
     this.prototypingService    = prototypingService;
     this.messageDisplayService = messageDisplayService;
     this.hostData = new Dictionary <string, object>();
     this.ResetInternal();
     this.RegisterImporters();
 }
 public SilverlightAssemblyResolver(AppDomain appDomain, IServiceProvider serviceProvider)
 {
     this.projectManager            = ServiceExtensions.ProjectManager(serviceProvider);
     this.platformService           = ServiceExtensions.GetService <IPlatformService>(serviceProvider);
     this.satelliteAssemblyResolver = ServiceExtensions.GetService <ISatelliteAssemblyResolver>(serviceProvider);
     this.messageService            = ServiceExtensions.GetService <IMessageDisplayService>(serviceProvider);
     this.appDomain = appDomain;
     this.appDomain.AssemblyLoad += new AssemblyLoadEventHandler(this.AppDomain_AssemblyLoad);
 }
        public static void DisplayFailureMessage(this IServiceProvider source, string failure, string description)
        {
            IMessageDisplayService messageDisplayService = source.MessageDisplayService();
            CultureInfo            currentCulture        = CultureInfo.CurrentCulture;
            string dialogFailedMessage = StringTable.DialogFailedMessage;

            object[] objArray = new object[] { failure, description };
            messageDisplayService.ShowError(string.Format(currentCulture, dialogFailedMessage, objArray));
        }
 protected SourceControlProcess(SourceControlProcessModel model, IServiceProvider serviceProvider)
     : base((IAsyncMechanism) new CurrentDispatcherAsyncMechanism(DispatcherPriority.Background))
 {
     this.Model        = model;
     this.StillWorking = true;
     this.expressionInformationService = serviceProvider.GetService(typeof(IExpressionInformationService)) as IExpressionInformationService;
     this.displayService       = serviceProvider.GetService(typeof(IMessageDisplayService)) as IMessageDisplayService;
     this.sourceControlService = serviceProvider.GetService(typeof(ISourceControlService)) as SourceControlService;
 }
        protected void ProcessLicenseServiceResponse(IEnterKeyResponse response)
        {
            ILicenseService        service1 = this.Services.GetService <ILicenseService>();
            IMessageDisplayService service2 = this.Services.GetService <IMessageDisplayService>();

            this.IsLicensed = response.IsEnabled;
            if ((int)response.ErrorCode != -1073418160)
            {
                LicensingDialogHelper.ShowErrorMessageFromResponse((ILicenseSubServiceResponse)response, service2);
            }
            if (!response.IsEnabled)
            {
                if (service1.HasKey(response.KeySku) && service1.GetUnlicensedReason(response.KeySku) == UnlicensedReason.GraceTimeExpired)
                {
                    MessageBoxArgs args = new MessageBoxArgs()
                    {
                        Owner   = (Window)this,
                        Message = StringTable.LicensingYouNeedToActivate,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Exclamation
                    };
                    int num = (int)service2.ShowMessage(args);
                }
                else
                {
                    MessageBoxArgs args = new MessageBoxArgs()
                    {
                        Owner   = (Window)this,
                        Message = StringTable.LicensingInvalidKeyMessage,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Hand
                    };
                    int num = (int)service2.ShowMessage(args);
                }
            }
            else if (this.ShouldActivate && service1.SkusFromFeature(ExpressionFeatureMapper.ActivationLicense).Contains(response.KeySku) && !response.IsActivated)
            {
                MessageBoxArgs args = new MessageBoxArgs()
                {
                    Owner   = (Window)this,
                    Message = StringTable.LicensingEnterKeySucceededAndActivationFailed,
                    Image   = MessageBoxImage.Exclamation
                };
                int num = (int)service2.ShowMessage(args);
                LicensingDialogHelper.ShowActivationDialog(this.Services, (CommonDialogCreator) new ActivationDialogCreator(this.Services, ActivationWizardAction.ChooseActivationType));
            }
            else
            {
                MessageBoxArgs args = new MessageBoxArgs()
                {
                    Owner   = (Window)this,
                    Message = StringTable.LicensingValidMessage
                };
                int num = (int)service2.ShowMessage(args);
            }
        }
        /// <summary>Initializes a new instance of the <see cref="ViewModelInjection"/> class.</summary>
        /// <param name="copy">The objects to copy.</param>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="copy"/> parameter is <b>null</b>.</exception>
        protected ViewModelInjection(IViewModelInjection copy)
        {
            if (copy == null)
            {
                throw new ArgumentNullException(nameof(copy));
            }

            Log            = copy.Log;
            BusyService    = copy.BusyService;
            MessageDisplay = copy.MessageDisplay;
        }
Beispiel #22
0
        public static bool EnsureProductIsLicensed(IServices services, int nagAtDays)
        {
            services.GetService <ILicenseService>().WaitForValidLicenseInformation();
            IMessageDisplayService service = services.GetService <IMessageDisplayService>();
            bool flag;

            switch (LicensingDialogHelper.DialogToDisplay(services, nagAtDays))
            {
            case LicenseDialogPopup.NoDialog:
                flag = true;
                break;

            case LicenseDialogPopup.LicenseDialog:
                flag = LicensingDialogHelper.ShowLicensingDialog(services, (CommonDialogCreator) new LicensingDialogCreator(services));
                break;

            case LicenseDialogPopup.TrialExpiredDialog:
                flag = LicensingDialogHelper.ShowTrialExpiredDialog(services, (CommonDialogCreator) new TrialExpiredDialogCreator(services));
                break;

            case LicenseDialogPopup.ActivationGraceExpiredDialog:
                flag = LicensingDialogHelper.ShowActivationGraceExpiredDialog(services, (CommonDialogCreator) new ActivationGraceExpiredDialogCreator(services));
                break;

            case LicenseDialogPopup.ProductSkuNotInstalled:
                MessageBoxArgs args1 = new MessageBoxArgs()
                {
                    Message = StringTable.LicensingProductSkuLicenseNotInstalledMessage,
                    Button  = MessageBoxButton.OK,
                    Image   = MessageBoxImage.Hand
                };
                if (service != null)
                {
                    int num1 = (int)service.ShowMessage(args1);
                }
                flag = false;
                break;

            default:
                MessageBoxArgs args2 = new MessageBoxArgs()
                {
                    Message = StringTable.LicensingInitializationFailureMessage,
                    Button  = MessageBoxButton.OK,
                    Image   = MessageBoxImage.Hand
                };
                if (service != null)
                {
                    int num2 = (int)service.ShowMessage(args2);
                }
                flag = false;
                break;
            }
            return(flag);
        }
Beispiel #23
0
 public DocumentService(ICommandService commandService, IMessageDisplayService messageDisplayService)
 {
     this.commandService = commandService;
     this.AddCommand("Application_FileSave", (Microsoft.Expression.Framework.Commands.ICommand) new DocumentService.FileSaveCommand((IDocumentService)this, messageDisplayService));
     this.AddCommand("Application_FileClose", (Microsoft.Expression.Framework.Commands.ICommand) new DocumentService.FileCloseCommand((IDocumentService)this, messageDisplayService));
     this.AddCommand("Windows_Empty", (Microsoft.Expression.Framework.Commands.ICommand) new DocumentService.EmptyActivateViewCommand((IViewService)this));
     for (int index = 0; index < 10; ++index)
     {
         this.AddCommand("Windows_View_" + index.ToString((IFormatProvider)CultureInfo.InvariantCulture), (Microsoft.Expression.Framework.Commands.ICommand) new DocumentService.ActivateViewCommand((IViewService)this, index));
     }
     this.AddCommand("Windows_More", (Microsoft.Expression.Framework.Commands.ICommand) new DocumentService.ViewServiceDialogCommand((IViewService)this));
 }
Beispiel #24
0
 private FindDialog(FindReplaceModel findReplaceModel, ITextEditor textEditor, IMessageDisplayService messageManager)
 {
     this.textEditor       = textEditor;
     this.messageManager   = messageManager;
     this.findReplaceModel = findReplaceModel;
     this.DialogContent    = (UIElement)Microsoft.Expression.Code.FileTable.GetElement("UserInterface\\FindDialog.xaml");
     this.Title            = StringTable.FindDialogTitle;
     this.SizeToContent    = SizeToContent.WidthAndHeight;
     this.DataContext      = (object)this;
     this.findNextCommand  = new DelegateCommand(new DelegateCommand.SimpleEventHandler(this.OnFindNext));
     this.FindText         = this.FindText;
 }
 internal CodeProjectService(IProjectManager projectManager, IAssemblyService assemblyService, IMessageDisplayService messageDisplayService, IViewService viewService, IDocumentTypeManager documentTypeManager)
 {
     this.projectManager        = projectManager;
     this.assemblyService       = assemblyService;
     this.messageDisplayService = messageDisplayService;
     this.viewService           = viewService;
     this.documentTypeManager   = documentTypeManager;
     if (this.projectManager == null)
     {
         return;
     }
     this.projectManager.ProjectClosed += new EventHandler <ProjectEventArgs>(this.OnProjectClosed);
 }
Beispiel #26
0
 internal CodeView(IDocument document, ICodeProject codeProject, IMessageDisplayService messageDisplayService, IViewService viewService, CodeOptionsModel codeOptionsModel, Microsoft.Expression.Framework.UserInterface.IWindowService windowService)
     : base(document)
 {
     Application.Current.Activated += new EventHandler(this.Application_Activated);
     this.codeDocument              = (CodeDocument)document;
     this.messageDisplayService     = messageDisplayService;
     this.viewService      = viewService;
     this.codeOptionsModel = codeOptionsModel;
     this.actiproEditor    = new ActiproEditor(this.codeDocument.Document, this.codeOptionsModel, this.messageDisplayService, this.viewService, codeProject, windowService);
     this.actiproEditor.CommandExecutionRequested += new EventHandler <CommandExecutionRequestedEventArgs>(this.ActiproEditor_CommandExecutionRequested);
     this.actiproEditor.EventInserted             += new EventHandler <InsertEventHandlerEventArgs>(this.Editor_EventInserted);
     this.AddCommands();
 }
Beispiel #27
0
        protected ViewModelBase()
        {
            Commands           = new List <DisplayEntities.Action>();
            SessionDiagnostics = new Display.Session <DTO.NullT>();

            //TODO: pass in IMessageDisplayService provider via a constructor parameter and resolve using dependency injection.
            //The following is for initial development only:
            _messageDisplayService = new APLPX.UI.WPF.ApplicationServices.WpfMessageDisplayService();

#if DEBUG
            IsDebugMode = true;
#endif
        }
Beispiel #28
0
 public ViewBridge(IWorkspaceService workspaceService, IViewService viewService, IMessageDisplayService messageDisplayService)
 {
     this.workspaceService                                  = workspaceService;
     this.viewService                                       = viewService;
     this.messageDisplayService                             = messageDisplayService;
     this.viewService.ViewOpened                           += new ViewEventHandler(this.ViewService_ViewOpened);
     this.viewService.ViewClosed                           += new ViewEventHandler(this.ViewService_ViewClosed);
     this.viewService.ActiveViewChanged                    += new ViewChangedEventHandler(this.ViewService_ActiveViewChanged);
     this.workspaceService.ActiveWorkspaceChanging         += new CancelEventHandler(this.WorkspaceService_ActiveWorkspaceChanging);
     this.workspaceService.ActiveWorkspaceChangingCanceled += new EventHandler(this.WorkspaceService_ActiveWorkspaceChangingCanceled);
     this.workspaceService.ActiveWorkspaceChanged          += new EventHandler(this.WorkspaceService_ActiveWorkspaceChanged);
     DockOperations.DockPositionChanging                   += new EventHandler <DockEventArgs>(this.DockOperations_DockPositionChanging);
     DockOperations.DockPositionChanged                    += new EventHandler <DockEventArgs>(this.DockOperations_DockPositionChanged);
 }
Beispiel #29
0
        private void ShowMefComposeError()
        {
            IConfigurationService        service1 = this.Services.GetService <IConfigurationService>();
            IMessageDisplayService       service2 = this.Services.GetService <IMessageDisplayService>();
            IMessageLoggingService       service3 = this.Services.GetService <IMessageLoggingService>();
            IExpressionMefHostingService service4 = this.Services.GetService <IExpressionMefHostingService>();

            if (this.mefExceptionToShow == null && Enumerable.Count <Exception>(service4.CompositionExceptions) <= 0)
            {
                return;
            }
            bool doNotAskAgain = service1 != null && (bool)service1["MEFHosting"].GetProperty("DoNotWarnAboutMefCompositionException", (object)false);

            if (!doNotAskAgain && service3 != null && (service4 != null && Enumerable.Count <Exception>(service4.CompositionExceptions) > 0))
            {
                foreach (Exception exception in service4.CompositionExceptions)
                {
                    service3.WriteLine(exception.Message);
                }
            }
            service4.ClearCompositionExceptions();
            if (!doNotAskAgain && service3 != null && (this.mefExceptionToShow != null && !string.IsNullOrEmpty(this.mefExceptionToShow.Message)))
            {
                service3.WriteLine(this.mefExceptionToShow.Message);
            }
            this.mefExceptionToShow = (Exception)null;
            if (doNotAskAgain || service2 == null)
            {
                return;
            }
            string         str  = Path.Combine(Path.GetDirectoryName(this.GetType().Module.FullyQualifiedName), "extensions");
            MessageBoxArgs args = new MessageBoxArgs()
            {
                Message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.MefCompositionException, new object[1]
                {
                    (object)str
                }),
                Button = MessageBoxButton.OK,
                Image  = MessageBoxImage.Exclamation
            };
            int num = (int)service2.ShowMessage(args, out doNotAskAgain);

            if (!doNotAskAgain || service1 == null)
            {
                return;
            }
            service1["MEFHosting"].SetProperty("DoNotWarnAboutMefCompositionException", (object)true);
        }
Beispiel #30
0
        /// <summary>Function to inject dependencies for the view model.</summary>
        /// <param name="injectionParameters">The parameters to inject.</param>
        /// <remarks>
        /// Applications should call this when setting up the view model for complex operations and/or dependency injection. The constructor should only be used for simple set up and initialization of objects.
        /// </remarks>
        protected override void OnInitialize(RecentVmParameters injectionParameters)
        {
            _recentItems    = injectionParameters.Settings?.RecentFiles ?? throw new ArgumentMissingException(nameof(RecentVmParameters.Settings), nameof(injectionParameters));
            _messageDisplay = injectionParameters.MessageDisplay ?? throw new ArgumentMissingException(nameof(RecentVmParameters.MessageDisplay), nameof(injectionParameters));

            // Only capture up to 150 items.
            Files = new ObservableCollection <RecentItem>(_recentItems.OrderByDescending(item => item.LastUsedDate).Take(150));

            // If there are more files in the settings than what we have in our list (due to the 150 item limit), then refresh the settings right now.
            if (Files.Count < _recentItems.Count)
            {
                _recentItems.Clear();
                _recentItems.AddRange(Files);
            }

            Files.CollectionChanged += Files_CollectionChanged;
        }