private void Generate_Click(object sender, RoutedEventArgs e)
        {
            statusText.Text = "Generating license...";

            if (string.IsNullOrEmpty(machineIdTextBox.Text))
            {
                statusText.Text = "Machine ID is required";
                return;
            }

            if (string.IsNullOrEmpty(privateKeyTextBox.Text))
            {
                statusText.Text = "Private key is required";
                return;
            }

            string errorMessage;
            var    licenseData = AppLicenseManager.GenerateLicenseData(
                machineIdTextBox.Text, privateKeyTextBox.Text, out errorMessage);

            if (null != errorMessage)
            {
                statusText.Text = $"Error while generating signature:{Environment.NewLine}{errorMessage}";
                return;
            }

            // The license data is generated. Save it
            statusText.Text = $"License data generated. Saving to file...";
            promptSave(licenseData);
        }
        public void TestInitialize()
        {
            ScreenFactory     = Substitute.For <IScreenFactory>();
            WindowManager     = Substitute.For <IWindowManagerEx>();
            QueueExplorer     = Substitute.For <IQueueExplorerViewModel>();
            EndpointExplorer  = Substitute.For <IEndpointExplorerViewModel>();
            MessageList       = Substitute.For <IMessageListViewModel>();
            StatusbarManager  = Substitute.For <IStatusBarManager>();
            EventAggregator   = Substitute.For <IEventAggregator>();
            MessageFlow       = Substitute.For <IMessageFlowViewModel>();
            SagaWindow        = Substitute.For <ISagaWindowViewModel>();
            MessageBodyView   = Substitute.For <IMessageBodyViewModel>();
            MessageProperties = Substitute.For <IMessagePropertiesViewModel>();
            View               = Substitute.For <IShellViewStub>();
            HeaderView         = Substitute.For <IMessageHeadersViewModel>();
            SettingsProvider   = Substitute.For <ISettingsProvider>();
            LicenseManager     = Substitute.For <AppLicenseManager>();
            LogWindow          = Substitute.For <ILogWindowViewModel>();
            ConnectToViewModel = Substitute.For <IConnectToMachineViewModel>();
            SettingsProvider.GetSettings <ProfilerSettings>().Returns(DefaultAppSetting());
            App = Substitute.For <IAppCommands>();
            CommandLineArgParser = MockEmptyStartupOptions();

            shell = new ShellViewModel(App, ScreenFactory, WindowManager, QueueExplorer,
                                       EndpointExplorer, MessageList, StatusbarManager,
                                       EventAggregator, LicenseManager, MessageFlow, SagaWindow,
                                       MessageBodyView, HeaderView, SettingsProvider, MessageProperties,
                                       LogWindow, CommandLineArgParser);

            ScreenFactory.CreateScreen <IConnectToMachineViewModel>().Returns(ConnectToViewModel);

            shell.AttachView(View, null);
        }
 public LicenseRegistrationViewModel(
     AppLicenseManager licenseManager,
     IWindowManagerEx dialogManager,
     NetworkOperations network)
 {
     this.licenseManager = licenseManager;
     this.dialogManager  = dialogManager;
     this.network        = network;
 }
 public LicenseRegistrationViewModel(
     AppLicenseManager licenseManager,
     IDialogManager dialogManager,
     INetworkOperations network)
 {
     this.licenseManager = licenseManager;
     _dialogManager      = dialogManager;
     _network            = network;
 }
 public LicenseRegistrationViewModel(
     AppLicenseManager licenseManager,
     IDialogManager dialogManager,
     INetworkOperations network)
 {
     this.licenseManager = licenseManager;
     _dialogManager = dialogManager;
     _network = network;
 }
Exemple #6
0
        public LicenseMessageBoxViewModel(
            AppLicenseManager licenseManager,
            NetworkOperations networkOperations,
            IWindowManagerEx windowManager,
            IAppCommands appCommands)
        {
            this.licenseManager    = licenseManager;
            this.networkOperations = networkOperations;
            this.windowManager     = windowManager;
            this.appCommands       = appCommands;

            SetupLicenseOptions();
        }
Exemple #7
0
        public ManageLicenseViewModel(
            AppLicenseManager licenseManager,
            NetworkOperations network,
            IWindowManagerEx windowManager,
            IEventAggregator eventAggregator)
        {
            this.licenseManager  = licenseManager;
            this.network         = network;
            this.windowManager   = windowManager;
            this.eventAggregator = eventAggregator;

            DisplayName      = "License Information";
            ContactUsCommand = Command.Create(ContactUs);
        }
Exemple #8
0
        public ShellViewModel(
            IAppCommands appCommander,
            IScreenFactory screenFactory,
            IWindowManagerEx windowManager,
            IQueueExplorerViewModel queueExplorer,
            IEndpointExplorerViewModel endpointExplorer,
            IMessageListViewModel messages,
            IStatusBarManager statusBarManager,
            IEventAggregator eventAggregator,
            AppLicenseManager licenseManager,
            IMessageFlowViewModel messageFlow,
            ISagaWindowViewModel sagaWindow,
            IMessageBodyViewModel messageBodyViewer,
            IMessageHeadersViewModel messageHeadersViewer,
            ISettingsProvider settingsProvider,
            IMessagePropertiesViewModel messageProperties,
            ILogWindowViewModel logWindow,
            ICommandLineArgParser comandLineArgParser)
        {
            _appCommander        = appCommander;
            _screenFactory       = screenFactory;
            _windowManager       = windowManager;
            _eventAggregator     = eventAggregator;
            _licenseManager      = licenseManager;
            _settingsProvider    = settingsProvider;
            _comandLineArgParser = comandLineArgParser;
            MessageProperties    = messageProperties;
            MessageFlow          = messageFlow;
            SagaWindow           = sagaWindow;
            StatusBarManager     = statusBarManager;
            QueueExplorer        = queueExplorer;
            EndpointExplorer     = endpointExplorer;
            MessageHeaders       = messageHeadersViewer;
            MessageBody          = messageBodyViewer;
            Messages             = messages;
            LogWindow            = logWindow;

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

            InitializeAutoRefreshTimer();
            InitializeIdleTimer();
        }
        public void TestInitialize()
        {
            windowManager     = Substitute.For <WindowManagerEx>();
            endpointExplorer  = Substitute.For <EndpointExplorerViewModel>();
            messageList       = Substitute.For <MessageListViewModel>();
            licenseStatusBar  = Substitute.For <LicenseStatusBar>();
            statusbarManager  = new StatusBarManager(licenseStatusBar);
            eventAggregator   = Substitute.For <IEventAggregator>();
            workNotifier      = Substitute.For <IWorkNotifier>();
            messageFlow       = Substitute.For <MessageFlowViewModel>();
            sagaWindow        = Substitute.For <SagaWindowViewModel>();
            messageBodyView   = Substitute.For <MessageBodyViewModel>();
            messageProperties = Substitute.For <MessagePropertiesViewModel>();
            view                = Substitute.For <IShellViewStub>();
            headerView          = Substitute.For <MessageHeadersViewModel>();
            sequenceDiagramView = Substitute.For <SequenceDiagramViewModel>();
            settingsProvider    = Substitute.For <ISettingsProvider>();
            licenseManager      = Substitute.For <AppLicenseManager>();
            logWindow           = Substitute.For <LogWindowViewModel>();
            settingsProvider.GetSettings <ProfilerSettings>().Returns(DefaultAppSetting());
            app = Substitute.For <IAppCommands>();
            commandLineArgParser = MockEmptyStartupOptions();

            shell = new ShellViewModel(
                app,
                windowManager,
                endpointExplorer,
                messageList,
                () => Substitute.For <ServiceControlConnectionViewModel>(),
                () => Substitute.For <LicenseMessageBoxViewModel>(),
                statusbarManager,
                eventAggregator,
                workNotifier,
                licenseManager,
                messageFlow,
                sagaWindow,
                messageBodyView,
                headerView,
                sequenceDiagramView,
                settingsProvider,
                messageProperties,
                logWindow,
                commandLineArgParser);

            ((IViewAware)shell).AttachView(view);
        }
Exemple #10
0
        public void TestInitialize()
        {
            WindowManager     = Substitute.For <WindowManagerEx>();
            EndpointExplorer  = Substitute.For <EndpointExplorerViewModel>();
            MessageList       = Substitute.For <MessageListViewModel>();
            StatusbarManager  = Substitute.For <StatusBarManager>();
            EventAggregator   = Substitute.For <IEventAggregator>();
            MessageFlow       = Substitute.For <MessageFlowViewModel>();
            SagaWindow        = Substitute.For <SagaWindowViewModel>();
            MessageBodyView   = Substitute.For <MessageBodyViewModel>();
            MessageProperties = Substitute.For <MessagePropertiesViewModel>();
            View                = Substitute.For <IShellViewStub>();
            HeaderView          = Substitute.For <MessageHeadersViewModel>();
            SequenceDiagramView = Substitute.For <SequenceDiagramViewModel>();
            SettingsProvider    = Substitute.For <ISettingsProvider>();
            LicenseManager      = Substitute.For <AppLicenseManager>();
            LogWindow           = Substitute.For <LogWindowViewModel>();
            SettingsProvider.GetSettings <ProfilerSettings>().Returns(DefaultAppSetting());
            App = Substitute.For <IAppCommands>();
            CommandLineArgParser = MockEmptyStartupOptions();

            shell = new ShellViewModel(
                App,
                WindowManager,
                EndpointExplorer,
                MessageList,
                () => Substitute.For <ServiceControlConnectionViewModel>(),
                () => Substitute.For <LicenseRegistrationViewModel>(),
                StatusbarManager,
                EventAggregator,
                LicenseManager,
                MessageFlow,
                SagaWindow,
                MessageBodyView,
                HeaderView,
                SequenceDiagramView,
                SettingsProvider,
                MessageProperties,
                LogWindow,
                CommandLineArgParser);

            ((IViewAware)shell).AttachView(View);
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var licensePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "license.json");

            // Generate license
            string      privateKeyXmlString = "";
            var         machineId           = AppLicenseManager.GetMachineId();
            string      errorMessage;
            LicenseData licenseData = AppLicenseManager.GenerateLicenseData(machineId, privateKeyXmlString, out errorMessage);

            // Write the license to a file
            string licenseJsonString = JsonSerializer.Serialize(licenseData);

            File.WriteAllText(licensePath, licenseJsonString);

            // Verify license
            string invalidReason;
            var    isLicenseValid = AppLicenseManager.IsLicenseValid(licensePath, out invalidReason);
        }
        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>());
        }