Ejemplo n.º 1
0
        protected override void OnViewAttached(object view, object context)
        {
            base.OnViewAttached(view, context);
            View = (IShellView)view;

            DisplayName = GetProductName();
            StatusBarManager.Done();
            RestoreLayout();
        }
        void DisplayRegistrationStatus()
        {
            var license = licenseManager.CurrentLicense;

            if (license == null)
            {
                return;
            }
            if (license.IsCommercialLicense)
            {
                StatusBarManager.SetRegistrationInfo("{0} license, registered to '{1}'", license.LicenseType, license.RegisteredTo);
            }
            else
            {
                StatusBarManager.SetRegistrationInfo("Trial license: {0} left", ("day").PluralizeWord(licenseManager.GetRemainingTrialDays()));
            }
        }
        public ShellViewModel(
            IAppCommands appCommander,
            IWindowManagerEx windowManager,
            EndpointExplorerViewModel endpointExplorer,
            MessageListViewModel messages,
            Func <ServiceControlConnectionViewModel> serviceControlConnection,
            Func <LicenseRegistrationViewModel> licenceRegistration,
            StatusBarManager statusBarManager,
            IEventAggregator eventAggregator,
            AppLicenseManager licenseManager,
            MessageFlowViewModel messageFlow,
            SagaWindowViewModel sagaWindow,
            MessageBodyViewModel messageBodyViewer,
            MessageHeadersViewModel messageHeadersViewer,
            SequenceDiagramViewModel sequenceDiagramViewer,
            ISettingsProvider settingsProvider,
            MessagePropertiesViewModel messageProperties,
            LogWindowViewModel logWindow,
            CommandLineArgParser comandLineArgParser)
        {
            this.appCommander             = appCommander;
            this.windowManager            = windowManager;
            this.eventAggregator          = eventAggregator;
            this.licenseManager           = licenseManager;
            this.settingsProvider         = settingsProvider;
            this.comandLineArgParser      = comandLineArgParser;
            this.serviceControlConnection = serviceControlConnection;
            this.licenceRegistration      = licenceRegistration;
            MessageProperties             = messageProperties;
            MessageFlow      = messageFlow;
            SagaWindow       = sagaWindow;
            StatusBarManager = statusBarManager;
            EndpointExplorer = endpointExplorer;
            MessageHeaders   = messageHeadersViewer;
            MessageBody      = messageBodyViewer;
            SequenceDiagram  = sequenceDiagramViewer;
            Messages         = messages;
            LogWindow        = logWindow;

            Items.Add(endpointExplorer);
            Items.Add(messages);
            Items.Add(messageHeadersViewer);
            Items.Add(messageBodyViewer);
            Items.Add(messageFlow);

            InitializeAutoRefreshTimer();
            InitializeIdleTimer();

            ShutDownCommand = this.CreateCommand(() => this.appCommander.ShutdownImmediately());
            AboutCommand    = this.CreateCommand(() => this.windowManager.ShowDialog <AboutViewModel>());
            HelpCommand     = this.CreateCommand(() => Process.Start(@"http://docs.particular.net/"));
            ConnectToServiceControlCommand = this.CreateCommand(ConnectToServiceControl, vm => vm.CanConnectToServiceControl);

            RefreshAllCommand = this.CreateCommand(RefreshAll);

            RegisterCommand = this.CreateCommand(() =>
            {
                this.windowManager.ShowDialog <LicenseRegistrationViewModel>();
                DisplayRegistrationStatus();
            });

            ResetLayoutCommand = this.CreateCommand(() => View.OnResetLayout(settingsProvider));

            OptionsCommand = this.CreateCommand(() => windowManager.ShowDialog <OptionsViewModel>());
        }