Exemplo n.º 1
0
 internal static void NavigateFromImportImagesToSelectImages(IApplicationController controller)
 {
     Assert.IsTrue(controller.IsOnImportImagesScreen);
     Assert.IsTrue(controller.CanBack());
     controller.Back();
     Assert.IsTrue(controller.IsOnSelectImagesScreen);
 }
        public MainWindowViewModel(IApplicationController applicationController, INavigationService navigationService, IDataTransferModel transferModel)
        {
            Guard.NotNull("navigationService", navigationService);

            NavigationService = navigationService;
            NavigationActions = new NavigationActionsViewModel(applicationController, navigationService, transferModel);
        }
Exemplo n.º 3
0
 public MainView(IApplicationController applicationController)
 {
     InitializeComponent();
     try
     {
         _applicationController = applicationController;
         _applicationController.Subscribe<ShowViewMessage>(this, OnShowView);
         _applicationController.Subscribe<ActivateViewMessage>(this, OnActivateView);
         _applicationController.Subscribe<StartPageShownMessage>(this, OnStartPageShown);
         _applicationController.Subscribe<StartPageHiddenMessage>(this, OnStartPageHidden);
         _applicationController.Subscribe<AlertsShownMessage>(this, OnAlertsShown);
         _applicationController.Subscribe<AlertsHiddenMessage>(this, OnAlertsHidden);
         _applicationController.Subscribe<DashboardShownMessage>(this, OnDashboardShown);
         _applicationController.Subscribe<DashboardHiddenMessage>(this, OnDashboardHidden);
         _applicationController.Subscribe<EditLoanMessage>(this, OnEditLoan);
         _applicationController.Subscribe<EditSavingMessage>(this, OnEditSaving);
         _applicationController.Subscribe<RestartApplicationMessage>(this, m =>
         {
             RestartApplication(m.Language);
         });
         SetUp();
         MefContainer.Current.Bind(this);
         _menuItems = new List<MenuObject>();
         _menuItems = Services.GetMenuItemServices().GetMenuList(OSecurityObjectTypes.MenuItem);
         LoadReports();
         LoadReportsToolStrip();
         InitializeTracer();
         DisplayWinFormDetails();
         InitMenu();
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public StageBedrijfViewModel(IApplicationController app)
 {
     _app = app;
     _saveCommand = new RelayCommand(Save);
     _backCommand = new RelayCommand(Back);
     _database = ModelFactory.Database;
 }
Exemplo n.º 5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            #if (DEBUG != true)
            // Don't handle the exceptions in Debug mode because otherwise the Debugger wouldn't
            // jump into the code when an exception occurs.
            DispatcherUnhandledException += AppDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;
            #endif

            AggregateCatalog catalog = new AggregateCatalog();
            // Add the WpfApplicationFramework assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(Controller).Assembly));
            // Add the Waf.BookLibrary.Library.Presentation assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            // Add the Waf.BookLibrary.Library.Applications assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(ShellViewModel).Assembly));

            this.container = new CompositionContainer(catalog);
            CompositionBatch batch = new CompositionBatch();
            batch.AddExportedValue(container);
            this.container.Compose(batch);

            this.applicationController = container.GetExportedValue<IApplicationController>();
            this.applicationController.Initialize();
            this.applicationController.Run();
        }
Exemplo n.º 6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            #if (DEBUG != true)
            // Don't handle the exceptions in Debug mode because otherwise the Debugger wouldn't
            // jump into the code when an exception occurs.
            DispatcherUnhandledException += AppDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;
            #endif
            XmlConfigurator.Configure();
            _log.Debug("OnStartup called");

            var catalog = new AggregateCatalog();
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(Controller).Assembly));
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(IApplicationController).Assembly));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(ValidationModel).Assembly));

            _container = new CompositionContainer(catalog);
            var batch = new CompositionBatch();
            batch.AddExportedValue(_container);
            _container.Compose(batch);

            _controller = _container.GetExportedValue<IApplicationController>();
            _controller.Initialize();
            _controller.Run();
        }
Exemplo n.º 7
0
 internal static void NavigateFromSelectPatientToSelectDrive(IApplicationController controller)
 {
     Assert.IsTrue(controller.IsOnSelectPatientScreen);
     Assert.IsTrue(controller.CanBack());
     controller.Back();
     Assert.IsTrue(controller.IsOnSelectDriveScreen);
 }
Exemplo n.º 8
0
        public ProfileViewModel(IApplicationController app)
            : base()
        {
            _app = app;
            uModule = new UserModule();
            filterList = new ObservableCollection<gymnast>();

            // Set the menu
            MenuViewModel menuViewModel = new MenuViewModel(_app);
            menuViewModel.VisibilityLaser = false;
            Menu = menuViewModel;

            // Get the user profile
            FilterField = "";
            gymnastList = uModule.getGymnastCollection();
            applyFilter();

            //Other misc stuff
            PictureCommandVisible = Visibility.Hidden;
            EnableFilter = true;
            inEditingMode = false;
            creatingNewGymnast = false;

            setValidationRules();
        }
 public LogInViewModel(IApplicationController app)
 {
     _app = app;
     this._ShowMainWindow = new RelayCommand(ShowMainWindow);
     this._WachtwoordVergeten = new RelayCommand(ShowWachtwoordView);
     _database = ModelFactory.Database;
 }
Exemplo n.º 10
0
 internal static void NavigateFromImportImagesToFinish(IApplicationController controller)
 {
     Assert.IsTrue(controller.IsOnImportImagesScreen);
     Assert.IsTrue(controller.CanNext());
     controller.Next();
     Assert.IsTrue(controller.IsOnSelectDriveScreen);
 }
Exemplo n.º 11
0
        public VaultSelectorViewModel(IApplicationController app)
            : base()
        {
            _app = app;

            // Set menu
            MenuViewModel menuViewModel = new MenuViewModel(_app);
            menuViewModel.VisibilityLaser = false;
            Menu = menuViewModel;

            ratingVM = new RatingViewModel(_app);
            RatingControl = ratingVM;

            // get all info on startup of this viewmodel
            List<location> locations = vaultModule.getLocations();
            List<vaultnumber> vaultnumbers = vaultModule.getVaultNumbers();
            locationList = new ObservableCollection<location>(locations);
            vaultNumberList = new ObservableCollection<vaultnumber>(vaultnumbers);

            gymnastList = userModule.getGymnastCollection();

            modifyVaultVM = new ModifyVaultViewModel(_app, "SELECT", gymnastList, vaultnumbers, vaultModule.getVaultKinds(), locations);
            ModifyViewModelControl = modifyVaultVM;
            this.Content = modifyVaultVM;
            modifyVaultVM.setData(null);

            dateVisibility = Visibility.Hidden;
            OnPropertyChanged("DateVisibility");

            FilterText = "";
            filterList = new ObservableCollection<string>();
        }
Exemplo n.º 12
0
 public VaultNumberEditorViewModel(IApplicationController app)
     : base()
 {
     _app = app;
     vaultnumberModule = new EditorModule();
     Vaults = vaultnumberModule.readVaultnumbers();
 }
Exemplo n.º 13
0
 internal static void NavigateFromSelectPatientToSelectImages(IApplicationController controller)
 {
     Assert.IsTrue(controller.IsOnSelectPatientScreen);
     Assert.IsTrue(controller.CanNext());
     controller.Next();
     Assert.IsTrue(controller.IsOnSelectImagesScreen);
 }
 public StudentPersoonViewModel(IApplicationController app)
 {
     _app = app;
     _verderCommand = new RelayCommand(Verder);
     _terugCommand = new RelayCommand(Back);
     fillEducation();
 }
Exemplo n.º 15
0
        public FormLogs(IApplicationController controller, StratumModel stratum)
            : base()
        {
            this.Controller = controller;
            InitializeComponent();
            this.KeyPreview = true;

            if (ViewController.PlatformType == PlatformType.WinCE)
            {
                this.WindowState = FormWindowState.Maximized;
                this._ceControlPanel.Visible = true;
                this.Menu = null;
                this.mainMenu1.Dispose();
                this.mainMenu1 = null;
            }
            else if (ViewController.PlatformType == PlatformType.WM)
            {
                this._sip = new Microsoft.WindowsCE.Forms.InputPanel();
                this.components.Add(_sip);
                this._dataGrid.SIP = this._sip;
            }

            this._dataGrid.CellValidating += new EditableDataGridCellValidatingEventHandler(_dataGrid_CellValidating);

            DataGridAdjuster.InitializeGrid(this._dataGrid);
            DataGridTableStyle tableStyle = DataGridAdjuster.InitializeLogColumns(stratum, _dataGrid);

            _logNumColumn = tableStyle.GridColumnStyles[CruiseDAL.Schema.LOG.LOGNUMBER] as EditableTextBoxColumn;
        }
Exemplo n.º 16
0
 public VaultKindEditorViewModel(IApplicationController app)
     : base()
 {
     _app = app;
     vaultKindModule = new EditorModule();
     Vaults = vaultKindModule.readVaultKinds();
 }
Exemplo n.º 17
0
        public ConfigPresenter(IApplicationController applicationController, IConfigForm form)
        {
            this.applicationController = applicationController;
            this.form = form;

            manager = new ConfigManager();
        }
Exemplo n.º 18
0
 public CorporateUserControl(Corporate corporate, Form pMdiParent, IApplicationController applicationController)
 {
     _applicationController = applicationController;
     _mdifrom = pMdiParent;
        _corporate = corporate;
     _fundingLine = null;
     InitializeComponent();
     InitializeUserControlsAddress();
     InitializeCorporate();
     PicturesServices ps = ServicesProvider.GetInstance().GetPicturesServices();
     if (ps.IsEnabled())
     {
         pictureBox1.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 0);
         pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
         pictureBox2.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 1);
         pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
     }
     else
     {
         pictureBox1.Visible = false;
         pictureBox2.Visible = false;
         linkLabelChangePhoto.Visible = false;
         linkLabelChangePhoto2.Visible = false;
     }
 }
Exemplo n.º 19
0
 public LocationEditorViewModel(IApplicationController app)
     : base()
 {
     _app = app;
     locationModule = new EditorModule();
     Locations = locationModule.readLocations();
 }
 public GebruikerAccountViewModel(IApplicationController app)
 {
     _app = app;
     _opslaanCommand = new RelayCommand(Opslaan);
     _terugCommand = new RelayCommand(Terug);
     _database = ModelFactory.Database;
 }
Exemplo n.º 21
0
 public AddGuarantorForm(Form pMdiParent, Currency tcode, IApplicationController applicationController)
 {
     _mdiParent = pMdiParent;
     _guarantor = new Guarantor();
     _guarantor.Amount = 0;
     code = tcode;
     Initialization();
 }
Exemplo n.º 22
0
 public ThumbnailViewModel(IApplicationController app)
     : base()
 {
     _app = app;
     LiveLabelVisibility = Visibility.Hidden;
     LivePadding = new Thickness(5, 0, 5, 0);
     GymnastVisibility = Visibility.Hidden;
 }
Exemplo n.º 23
0
        public MainViewModel(IApplicationController app)
            : base()
        {
            _app = app;

            // Create the menu
            MenuViewModel menuViewModel = new MenuViewModel(_app);
        }
        public StartNewImportCommand(IApplicationController applicationController, INavigationService navigationService, IDataTransferModel transferModel)
            : base(navigationService)
        {
            this.transferModel = transferModel;
            this.applicationController = applicationController;

            transferModel.Subscribe(m => m.ImportCancellation, OnCancellationChanged);
        }
 public void SetUp()
 {
     _controller = Substitute.For<IApplicationController>();
     _user = new User { Name = "admin", Password = "******" };
     _view = Substitute.For<IChangeUsernameView>();
     var presenter = new ChangeUsernamePresenter(_controller, _view);
     presenter.Run(_user);
 }
 public void SetUp()
 {
     _controller = Substitute.For<IApplicationController>();
     _user = new User { Name = "admin", Password = "******" };
     _view = Substitute.For<IMainView>();
     _presenter = new MainPresener(_controller, _view);
     _presenter.Run(_user);
 }
Exemplo n.º 27
0
 public void before_each()
 {
     dialogLauncher = MockRepository.GenerateMock<IDialogLauncher>();
     providerFactory = MockRepository.GenerateStub<ILogProviderFactory<FileLogProviderCreationContext>>();
     createdProvider = MockRepository.GenerateStub<ILogProvider>();
     applicationController = MockRepository.GenerateMock<IApplicationController>();
     context = new FileLogProviderCreationContext("log.txt");
 }
Exemplo n.º 28
0
 public MenuViewModel(IApplicationController app)
     : base()
 {
     _app = app;
     PilotLaserTitle = "Set Pilot Laser On";
     LogName = _app.IsLoggedIn ? "Logout" : "Login";
     VisibilityLaserOn = Visibility.Hidden;
 }
Exemplo n.º 29
0
 public SearchPresenter(
     ISearchView view,
     IApplicationController applicationController,
     ISearchRepository searchRepository)
 {
     _view = view;
     _applicationController = applicationController;
     _searchRepository = searchRepository;
 }
Exemplo n.º 30
0
 public VillageBankPresenter(
     IVillageBankView view,
     IApplicationController applicationController,
     IVillageBankRepository villageBankRepository)
 {
     _view = view;
     _applicationController = applicationController;
     _villageBankRepository = villageBankRepository;
 }
Exemplo n.º 31
0
        public CompletionScreenViewModel(Action onClose, string heading, IEnumerable <XrmButtonViewModel> options,
                                         object completionObject,
                                         IApplicationController controller)
            : base(controller)
        {
            Heading = new HeadingViewModel(heading, controller);
            CompletionHeadingText = heading;
            CompletionOptions     = options;

            if (completionObject != null)
            {
                var formController = FormController.CreateForObject(completionObject, ApplicationController, null);
                CompletionDetails                  = new ObjectEntryViewModel(null, null, completionObject, formController);
                CompletionDetails.IsReadOnly       = true;
                CompletionDetails.PropertyChanged += CompletionDetails_PropertyChanged;
            }

            //CompletionDetails = new ObjectsGridSectionViewModel("Summary", completionDetails, controller);
            CloseButton = new XrmButtonViewModel("Close", onClose, controller);
        }
Exemplo n.º 32
0
        public override bool IsVisible(IApplicationController applicationController)
        {
            var packageSettings     = applicationController.ResolveType <XrmPackageSettings>();
            var visualStudioService = applicationController.ResolveType <IVisualStudioService>();

            if (visualStudioService == null)
            {
                throw new NullReferenceException("visualStudioService");
            }

            if (packageSettings.DeployIntoFieldProjects == null || !packageSettings.DeployIntoFieldProjects.Any())
            {
                return(base.IsVisible(applicationController));
            }

            var selectedItems = visualStudioService.GetSelectedItems();

            return(selectedItems.All(si => packageSettings.DeployIntoFieldProjects.Any(w => w.ProjectName == si.NameOfContainingProject)) &&
                   base.IsVisible(applicationController));
        }
Exemplo n.º 33
0
        public CopyProcessPresenter(IApplicationController controller, ICopyProcessView view, CopyProcessViewModel model, ICopyWorker copyWorker, IProcessWrapper processWrapper)
            : base(controller, view)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            if (copyWorker == null)
            {
                throw new ArgumentNullException("copyWorker");
            }
            if (processWrapper == null)
            {
                throw new ArgumentNullException("processWrapper");
            }

            _model          = model;
            _copyWorker     = copyWorker;
            _processWrapper = processWrapper;
        }
        public void Menu()
        {
            while (true)
            {
                Console.Clear();
                Console.Out.Flush();
                IApplicationController controller = null;
                IMenu menu = null;
                Console.WriteLine("============= GIAO DICH =============");
                Console.WriteLine("1. Ngan hang SHB");
                Console.WriteLine("2. Block Chain");
                Console.WriteLine("0. Thoat");
                Console.WriteLine("Vui long nhap lua chon cua ban: ");

                var choice = Int32.Parse(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    controller = new SHBController();
                    menu       = new SHBMenu();
                    break;

                case 2:
                    controller = new BlockChainController();
                    menu       = new BlockChainMenu();
                    break;

                case 0:
                    Environment.Exit(1);
                    break;

                default:
                    Console.WriteLine("Lua co sai vui long chon lai!");
                    break;
                }

                // check neu menu ko null thi chay tiep. ALT + ENTER may no tu sinh code chu e ko code :D
                menu?.Menu(controller);
            }
        }
        protected override Task Context()
        {
            _containerTask          = A.Fake <IContainerTask>();
            _projectRetriever       = A.Fake <IPKSimProjectRetriever>();
            _dataRepositoryTask     = A.Fake <IDataRepositoryExportTask>();
            _executionContext       = A.Fake <IExecutionContext>();
            _dialogCreator          = A.Fake <IDialogCreator>();
            _applicationController  = A.Fake <IApplicationController>();
            _templateTask           = A.Fake <ITemplateTask>();
            _parameterChangeUpdater = A.Fake <IParameterChangeUpdater>();
            _pkmlPersistor          = A.Fake <IPKMLPersistor>();
            _project = new PKSimProject();
            A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project);
            A.CallTo(() => _projectRetriever.Current).Returns(_project);
            A.CallTo(() => _executionContext.Project).Returns(_project);
            _objectTypeResolver = A.Fake <IObjectTypeResolver>();
            sut = new ObservedDataTask(_projectRetriever, _executionContext, _dialogCreator, _applicationController,
                                       _dataRepositoryTask, _templateTask, _containerTask, _parameterChangeUpdater, _pkmlPersistor, _objectTypeResolver);

            return(_completed);
        }
Exemplo n.º 36
0
        public void ShowMainWindowCommandTest()
        {
            IApplicationController applicationController = Container.GetExportedValue <IApplicationController>();

            applicationController.Initialize();
            FloatingViewModel floatingViewModel = Container.GetExportedValue <FloatingViewModel>();
            MainViewModel     mainViewModel     = Container.GetExportedValue <MainViewModel>();

            applicationController.Run();

            MockFloatingView floatingView = (MockFloatingView)Container.GetExportedValue <IFloatingView>();
            MockMainView     mainView     = (MockMainView)Container.GetExportedValue <IMainView>();

            Assert.IsTrue(floatingView.IsVisible);
            Assert.IsFalse(mainView.IsVisible);

            floatingViewModel.ShowMainWindowCommand.Execute(null);
            Assert.IsTrue(mainView.IsVisible);

            applicationController.ShutDown();
        }
Exemplo n.º 37
0
        public void ControllerLifecycle()
        {
            IApplicationController applicationController = Container.GetExportedValue <IApplicationController>();

            applicationController.Initialize();
            ShellViewModel shellViewModel = Container.GetExportedValue <ShellViewModel>();

            Assert.IsNotNull(shellViewModel.AboutCommand);
            Assert.IsNotNull(shellViewModel.SettingCommand);
            Assert.IsNotNull(shellViewModel.ExitCommand);

            applicationController.Run();
            MockShellView shellView = (MockShellView)Container.GetExportedValue <IShellView>();

            Assert.IsTrue(shellView.IsVisible);

            shellViewModel.ExitCommand.Execute(null);
            Assert.IsFalse(shellView.IsVisible);

            applicationController.Shutdown();
        }
Exemplo n.º 38
0
        public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage)
            : base(controller, view)
        {
            this._mediator             = mediator;
            this._configuration        = configuration;
            this._configurationStorage = configurationStorage;

            this._descriptionsCache = new Dictionary <string, IThumbnailDescription>();

            this._suppressSizeNotifications = false;
            this._exitApplication           = false;

            this.View.FormActivated              = this.Activate;
            this.View.FormMinimized              = this.Minimize;
            this.View.FormCloseRequested         = this.Close;
            this.View.ApplicationSettingsChanged = this.SaveApplicationSettings;
            this.View.ThumbnailsSizeChanged      = this.UpdateThumbnailsSize;
            this.View.ThumbnailStateChanged      = this.UpdateThumbnailState;
            this.View.DocumentationLinkActivated = this.OpenDocumentationLink;
            this.View.ApplicationExitRequested   = this.ExitApplication;
        }
Exemplo n.º 39
0
        public void Initialize()
        {
            Container = CompositionHelper.GetContainer();
            CompositionHelper.ComposeContainerWithDefaults(Container);
            CompositionHelper.ComposeMessageServiceImplementation(Container, GetMessageService());
            CompositionHelper.ComposeFileEnumeratorImplementation(Container, new FileEnumeratorHasMoreThanMaxNumberOfFiles());
            CompositionHelper.ComposeImportImagesViewImplementation(Container, GetImportImagesView());

            ApplicationController = Container.GetExportedValue <IApplicationController>();
            ApplicationController.Initialize();
            ApplicationController.Run();

            TestDataHelper.MakeDriveValid(ApplicationController.CurrentSelectDriveViewModel.Model);
            TestNavigationHelper.NavigateFromSelectDriveToSelectPatient(ApplicationController);

            TestDataHelper.MakePatientValid(ApplicationController.CurrentSelectPatientViewModel.Model);
            TestNavigationHelper.NavigateFromSelectPatientToSelectImages(ApplicationController);

            TestDataHelper.MakeImageSelectionValid(ApplicationController.CurrentSelectImagesViewModel.Model);
            TestNavigationHelper.NavigateFromSelectImagesToImportImages(ApplicationController);
        }
Exemplo n.º 40
0
        private static void RefreshConnectionNotification(IApplicationController controller, string message, bool isLoading = false)
        {
            var actions = new Dictionary <string, Action>();

            actions.Add("Create New", () =>
            {
                var dialog = new AppXrmConnectionEntryDialog(controller.ResolveType <IDialogController>());
                controller.NavigateTo(dialog);
            });
            var savedConnections = controller.ResolveType <ISavedXrmConnections>();

            if (savedConnections.Connections != null)
            {
                foreach (var connection in savedConnections.Connections.OrderBy(c => c.Name).ToArray())
                {
                    if (!string.IsNullOrWhiteSpace(connection.Name) &&
                        !connection.Active &&
                        !actions.ContainsKey(connection.Name))
                    {
                        actions.Add(connection.Name, () =>
                        {
                            controller.DoOnAsyncThread(() =>
                            {
                                var appSettingsManager = controller.ResolveType(typeof(ISettingsManager)) as ISettingsManager;
                                var recordconfig       = new ObjectMapping.ClassMapperFor <SavedXrmRecordConfiguration, XrmRecordConfiguration>().Map(connection);
                                appSettingsManager.SaveSettingsObject(recordconfig);
                                savedConnections = controller.ResolveType <ISavedXrmConnections>();
                                foreach (var item in savedConnections.Connections.OrderBy(c => c.Name).ToArray())
                                {
                                    item.Active = item.Name == connection.Name;
                                }
                                appSettingsManager.SaveSettingsObject(savedConnections);
                                RefreshXrmServices(connection, controller);
                            });
                        });
                    }
                }
            }
            controller.AddNotification("XRMCONNECTION", message, isLoading: isLoading, actions: actions);
        }
Exemplo n.º 41
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

#if (DEBUG != true)
            // Don't handle the exceptions in Debug mode because otherwise the Debugger wouldn't
            // jump into the code when an exception occurs.
            DispatcherUnhandledException += AppDispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;
#endif

            catalog = new AggregateCatalog();
            // Add the Framework assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(ViewModel).Assembly));
            // Add the Bugger.Presentation assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            // Add the Bugger.Applications assembly to the catalog
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(IApplicationController).Assembly));

            // Add the Bugger.Proxy assemblies to the catalog
            string proxyAsseblyPath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                "Proxies");
            foreach (var file in new System.IO.DirectoryInfo(proxyAsseblyPath).GetFiles())
            {
                if (file.Extension.ToLower() == ".dll" && file.Name.StartsWith("Bugger.Proxy."))
                {
                    catalog.Catalogs.Add(new AssemblyCatalog(file.FullName));
                }
            }

            container = new CompositionContainer(catalog);
            CompositionBatch batch = new CompositionBatch();
            batch.AddExportedValue(container);
            container.Compose(batch);

            controller = container.GetExportedValue <IApplicationController>();
            controller.Initialize();
            controller.Run();
        }
Exemplo n.º 42
0
        protected override void Context()
        {
            _applicationController         = A.Fake <IApplicationController>();
            _buildingBlockTask             = A.Fake <IBuildingBlockTask>();
            _buildingBlockInProjectManager = A.Fake <IBuildingBlockInProjectManager>();
            _lazyloadTask               = A.Fake <ILazyLoadTask>();
            _heavyWorkManager           = A.Fake <IHeavyWorkManager>();
            _containerTask              = A.Fake <IContainerTask>();
            _objectReferencingRetriever = A.Fake <IObjectReferencingRetriever>();
            _projectRetriever           = A.Fake <IProjectRetriever>();
            _renameAbsolutePathVisitor  = new RenameAbsolutePathVisitor();
            _objectPathFactory          = new ObjectPathFactoryForSpecs();
            _parameterIdentificationSimulationPathUpdater = A.Fake <IParameterIdentificationSimulationPathUpdater>();
            _dataRepositoryNamer      = A.Fake <IDataRepositoryNamer>();
            _curveNamer               = A.Fake <ICurveNamer>();
            _expressionProfileUpdater = A.Fake <IExpressionProfileUpdater>();

            sut = new RenameBuildingBlockTask(
                _buildingBlockTask,
                _buildingBlockInProjectManager,
                _applicationController,
                _lazyloadTask,
                _containerTask,
                _heavyWorkManager,
                _renameAbsolutePathVisitor,
                _objectReferencingRetriever,
                _projectRetriever,
                _parameterIdentificationSimulationPathUpdater,
                _dataRepositoryNamer,
                _curveNamer,
                _expressionProfileUpdater);

            _initialSimulationName      = "S";
            _individualSimulation       = new IndividualSimulation().WithName(_initialSimulationName);
            _individualSimulation.Model = new Model().WithName(_initialSimulationName);
            _simulation = _individualSimulation;
            _root       = new Container().WithName(_initialSimulationName);
            _individualSimulation.Model.Root = _root;
        }
Exemplo n.º 43
0
 public DynamicGridViewModel(IApplicationController applicationController)
     : base(applicationController)
 {
     DisplayHeaders   = true;
     LoadingViewModel = new LoadingViewModel(applicationController);
     //this one a bit of a hack as loading/display controlled in code behind so set the vm as always loading
     SortLoadingViewModel = new LoadingViewModel(applicationController)
     {
         LoadingMessage = "Please Wait While Reloading Sorted Items", IsLoading = true
     };
     OnDoubleClick      = () => { };
     OnClick            = () => { };
     OnKeyDown          = () => { };
     PreviousPageButton = new XrmButtonViewModel("Prev", () =>
     {
         if (PreviousPageButton.Enabled)
         {
             HasNavigated = true;
             --CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     NextPageButton = new XrmButtonViewModel("Next", () =>
     {
         if (NextPageButton.Enabled)
         {
             HasNavigated = true;
             ++CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     MaxHeight          = 600;
     LoadDialog         = (d) => { ApplicationController.UserMessage(string.Format("Error The {0} Method Has Not Been Set In This Context", nameof(LoadDialog))); };
     RemoveParentDialog = () => { ApplicationController.UserMessage(string.Format("Error The {0} Method Has Not Been Set In This Context", nameof(RemoveParentDialog))); };
 }
 public SensitivityAnalysisParameterSelectionPresenter(
     ISensitivityAnalysisParameterSelectionView view,
     ISimulationParametersPresenter simulationParametersPresenter,
     ISensitivityAnalysisParametersPresenter sensitivityAnalysisParametersPresenter,
     ISimulationRepository simulationRepository,
     ILazyLoadTask lazyLoadTask,
     ISimulationSelector simulationSelector,
     ISensitivityAnalysisTask sensitivityAnalysisTask,
     IApplicationController applicationController) : base(view)
 {
     _simulationParametersPresenter          = simulationParametersPresenter;
     _sensitivityAnalysisParametersPresenter = sensitivityAnalysisParametersPresenter;
     _simulationRepository    = simulationRepository;
     _lazyLoadTask            = lazyLoadTask;
     _simulationSelector      = simulationSelector;
     _sensitivityAnalysisTask = sensitivityAnalysisTask;
     _applicationController   = applicationController;
     _subPresenterManager.Add(_simulationParametersPresenter);
     _subPresenterManager.Add(_sensitivityAnalysisParametersPresenter);
     _view.AddSimulationParametersView(_simulationParametersPresenter.BaseView);
     _view.AddSensitivityParametersView(_sensitivityAnalysisParametersPresenter.BaseView);
 }
Exemplo n.º 45
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            _catalog = new AggregateCatalog();
            // Add the WpfApplicationFramework assembly to the catalog
            _catalog.Catalogs.Add(new AssemblyCatalog(typeof(ViewModel).Assembly));
            // Add the Writer.Presentation assembly to the catalog
            _catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            // Add the Writer.Applications assembly to the catalog
            _catalog.Catalogs.Add(new AssemblyCatalog(typeof(IApplicationController).Assembly));

            _container = new CompositionContainer(_catalog, CompositionOptions.DisableSilentRejection);
            CompositionBatch batch = new CompositionBatch();

            batch.AddExportedValue(_container);
            _container.Compose(batch);

            _controller = _container.GetExportedValue <IApplicationController>();
            _controller.Initialize();
            _controller.Run();
        }
Exemplo n.º 46
0
        private static void CreatePresenterInstances(IApplicationController applicationController,
                                                     IGraphControlFormView formView,
                                                     IGraphControlView controlView,
                                                     IScalingSelectionView scalingView,
                                                     IGraphControlFormState graphControlFormState,
                                                     IScalingState scalingState,
                                                     IDataService dataService,
                                                     IScaleService scaleService,
                                                     IBufferedDrawingService bufferedDrawingService,
                                                     IBackgroundPresenter backgroundPresenter,
                                                     IGridPresenter gridPresenter,
                                                     IDataPresenter dataPresenter)
        {
            var scalingPresenter = new ScalingSelectionPresenter(scalingView, scalingState, controlView, scaleService);

            applicationController.RegisterInstance <IScalingSelectionPresenter>(scalingPresenter);

            var graphControlPresenter = new GraphControlPresenter(applicationController,
                                                                  controlView,
                                                                  dataService,
                                                                  scaleService,
                                                                  bufferedDrawingService,
                                                                  backgroundPresenter,
                                                                  gridPresenter,
                                                                  dataPresenter,
                                                                  scalingPresenter
                                                                  );

            applicationController.RegisterInstance <IGraphControlPresenter>(graphControlPresenter);

            var graphControlFormPresenter = new GraphControlFormPresenter(
                applicationController,
                formView,
                graphControlFormState,
                graphControlPresenter
                );

            applicationController.RegisterInstance <GraphControlFormPresenter>(graphControlFormPresenter);
        }
Exemplo n.º 47
0
        protected void InitializeCommon(IApplicationController controller,
                                        ApplicationSettings appSettings,
                                        IDataEntryDataService dataService,
                                        ISampleSelectorRepository sampleSelectorRepository)
        {
            KeyPreview = true;

            Controller  = controller;
            DataService = dataService;
            AppSettings = appSettings;
            SampleSelectorRepository = sampleSelectorRepository;

            LogicController = new FormDataEntryLogic(Controller,
                                                     DialogService.Instance,
                                                     SoundService.Instance,
                                                     DataService,
                                                     AppSettings,
                                                     this,
                                                     sampleSelectorRepository);

            InitializePageContainer();
        }
Exemplo n.º 48
0
        protected override void Context()
        {
            _parameterIdentificationFactory = A.Fake <IParameterIdentificationFactory>();
            _withIdRepository = A.Fake <IWithIdRepository>();
            _entitiesInSimulationRetriever  = A.Fake <IEntitiesInSimulationRetriever>();
            _observedDataRepository         = A.Fake <IObservedDataRepository>();
            _entityPathResolver             = A.Fake <IEntityPathResolver>();
            _identificationParameterFactory = A.Fake <IIdentificationParameterFactory>();
            _executionContext        = A.Fake <IOSPSuiteExecutionContext>();
            _favoriteRepository      = A.Fake <IFavoriteRepository>();
            _simulationSwapValidator = A.Fake <IParameterIdentificationSimulationSwapValidator>();
            _applicationController   = A.Fake <IApplicationController>();
            _simulationSwapCorrector = A.Fake <IParameterIdentificationSimulationSwapCorrector>();
            _dialogCreator           = A.Fake <IDialogCreator>();
            _simulationSelector      = A.Fake <ISimulationSelector>();
            _parameterAnalysableParameterSelector = A.Fake <IParameterAnalysableParameterSelector>();

            _heavyWorkManager = new HeavyWorkManagerForSpecs();
            sut = new ParameterIdentificationTask(_parameterIdentificationFactory, _withIdRepository, _entitiesInSimulationRetriever, _observedDataRepository,
                                                  _entityPathResolver, _identificationParameterFactory, _executionContext, _favoriteRepository, _simulationSwapValidator, _applicationController,
                                                  _simulationSwapCorrector, _dialogCreator, _simulationSelector, _heavyWorkManager, _parameterAnalysableParameterSelector);
        }
Exemplo n.º 49
0
        public StartPresenter(IStartView view, IApplicationController applicationController) : base(view, applicationController)
        {
            view.SessionStarted       += ViewSessionStarted;
            view.ViewShown            += ViewViewShown;
            view.ConnectionAsked      += ViewConnected;
            view.ExamSelectionChanged += ViewExamChanged;
            view.ExamDeleted          += ViewDeleted;
            view.FileOpened           += ViewOpened;
            view.DeleteResult         += ViewDeleteResult;
            view.ExamEdited           += ViewExamEdited;
            view.ExamCreated          += ViewExamCreated;
            view.WatchTask            += ViewWatchTask;
            view.WatchResult          += ViewWatchResult;
            view.WatchBlank           += ViewWatchBlank;
            ExamsListService examsList = ExamsListService.GetInstance();

            examsList.ListRefreshed += ExamsListListRefreshed;
            DatabaseService databaseService = DatabaseService.GetInstance();

            databaseService.ConnctionEstablished += DatabaseServiceConnctionEstablished;
            databaseService.ConnctionLosted      += DatabaseServiceConnctionLosted;
        }
Exemplo n.º 50
0
        public GraphControlPresenter(IApplicationController controller,
                                     IGraphControlView view,
                                     IDataService dataService,
                                     IScaleService scaleService,
                                     IBufferedDrawingService bufferedDrawingService,
                                     IBackgroundPresenter backgroundPresenter,
                                     IGridPresenter gridPresenter,
                                     IDataPresenter dataPresenter,
                                     IScalingSelectionPresenter scalingSelectionPresenter) : base(controller, view)
        {
            if (dataService == null)
            {
                throw new InvalidArgumentException("data sevice is null");
            }
            this.scaleService              = scaleService;
            this.backgroundPresenter       = backgroundPresenter;
            this.gridPresenter             = gridPresenter;
            this.dataPresenter             = dataPresenter;
            this.scalingSelectionPresenter = scalingSelectionPresenter;

            dataService.DataUpdated += GraphControlPresenter_DataUpdated;

            this.View.DrawGraph          += View_DrawGraph;
            this.View.ControlSizeChanged += View_ControlSizeChanged;

            this.View.MouseDown  += this.scalingSelectionPresenter.MouseDown;
            this.View.MouseMove  += this.scalingSelectionPresenter.MouseMove;
            this.View.MouseUp    += this.scalingSelectionPresenter.MouseUp;
            this.View.MouseWheel += this.scalingSelectionPresenter.MouseWheel;

            if (bufferedDrawingService == null)
            {
                throw new InvalidArgumentException("parameter is null");
            }
            this.bufferedDrawingService              = bufferedDrawingService;
            this.bufferedDrawingService.UpdateScale += BufferedDrawingService_UpdateScale;
            this.bufferedDrawingService.DrawGraph   += BufferedDrawingService_DrawGraph;
            this.bufferedDrawingService.SetImage    += BufferedDrawingService_SetImage;
        }
Exemplo n.º 51
0
 /// <summary>
 /// Initializes a new instance of the DataEditorPresenter class.
 /// </summary>
 public DataEditorPresenter(IApplicationController applicationController,
                            IDataEditorView dataEditor,
                            IFileDialogCreator fileDialogCreator,
                            IMessageCreator messageCreator,
                            IUserSettingsRepository userSettingsRepository,
                            IProjectRepository projectRepository,
                            IDataSetProvider datasetProvider,
                            IFileService fileService)
 {
     _fileService                         = fileService;
     _messageCreator                      = messageCreator;
     _fileDialogCreator                   = fileDialogCreator;
     _applicationController               = applicationController;
     _datasetProvider                     = datasetProvider;
     _projectRepository                   = projectRepository;
     _userSettingsRepository              = userSettingsRepository;
     _dataEditor                          = dataEditor;
     _dataEditor.Initialize              += OnInitializeView;
     _dataEditor.ReloadData              += () => _applicationController.ExecuteCommand <ReloadDataCommand>();
     _dataEditor.BrowseForDataFile       += SelectDataFile;
     _dataEditor.BrowseForSchemaFile     += SelectSchemaFile;
     _dataEditor.CreateGuid              += CreateGuid;
     _dataEditor.GetDataSetFromDatabase  += GetDataSetFromDatabase;
     _dataEditor.SaveData                += OnSaveData;
     _dataEditor.SaveDataAs              += OnSaveDataAs;
     _dataEditor.NewData                 += OnNewData;
     _dataEditor.DataViewChanged         += HandleDataSetChange;
     _dataEditor.SaveProject             += SaveEditorSettings;
     _dataEditor.SaveProjectAs           += SaveEditorSettingsAs;
     _dataEditor.LoadProject             += LoadEditorSettings;
     _dataEditor.NewProject              += new Action(OnNewProject);
     _dataEditor.ExitApp                 += OnExitingApplication;
     _dataEditor.TableTreeNodeDblClicked += SchemaTableNodeClicked;
     _dataEditor.TabSelected             += OnTabSelected;
     _dataEditor.TableClosed             += OnTableClosed;
     _dataEditor.DataFileChanged         += OnDataFileChanged;
     _dataEditor.SchemaFileChanged       += OnSchemaFileChanged;
     _applicationController.Subscribe <ReinitializeMainViewRequested>((e) => OnReinitializeMainView());
 }
        protected override Task Context()
        {
            _project           = A.Fake <PKSimProject>();
            _entityTask        = A.Fake <IEntityTask>();
            _templateTaskQuery = A.Fake <ITemplateTaskQuery>();
            _executionContext  = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.CurrentProject).Returns(_project);
            _applicationController         = A.Fake <IApplicationController>();
            _buildingBlockInProjectManager = A.Fake <IBuildingBlockInProjectManager>();
            _buildingBlockRepository       = A.Fake <IBuildingBlockRepository>();
            _clonePresenter             = A.Fake <ICloneBuildingBlockPresenter>();
            _renamePresenter            = A.Fake <IRenameObjectPresenter>();
            _dialogCreator              = A.Fake <IDialogCreator>();
            _singleStartPresenterTask   = A.Fake <ISingleStartPresenterTask>();
            _lazyLoadTask               = A.Fake <ILazyLoadTask>();
            _presenterSettingsTask      = A.Fake <IPresentationSettingsTask>();
            _simulationReferenceUpdater = A.Fake <ISimulationReferenceUpdater>();

            sut = new BuildingBlockTask(
                _executionContext,
                _applicationController,
                _dialogCreator,
                _buildingBlockInProjectManager,
                _entityTask,
                _templateTaskQuery,
                _singleStartPresenterTask,
                _buildingBlockRepository,
                _lazyLoadTask,
                _presenterSettingsTask,
                _simulationReferenceUpdater);

            A.CallTo(() => _applicationController.Start <ICloneBuildingBlockPresenter>()).Returns(_clonePresenter);
            A.CallTo(() => _applicationController.Start <IRenameObjectPresenter>()).Returns(_renamePresenter);

            _buildingBlock = A.Fake <IPKSimBuildingBlock>();

            return(_completed);
        }
        protected override void Context()
        {
            _view                  = A.Fake <ICurveSettingsView>();
            _dimensionFactory      = A.Fake <IDimensionFactory>();
            _applicationController = A.Fake <IApplicationController>();
            _chart                 = new CurveChart();
            A.CallTo(() => _dimensionFactory.MergedDimensionFor(A <IWithDimension> ._)).ReturnsLazily(x => x.GetArgument <IWithDimension>(0).Dimension);

            var dataRepo1 = DomainHelperForSpecs.SimulationDataRepositoryFor("Sim1");

            _datColumn1 = dataRepo1.FirstDataColumn();

            var dataRepo2 = DomainHelperForSpecs.SimulationDataRepositoryFor("Sim2");

            _datColumn2 = dataRepo2.FirstDataColumn();

            _curve1 = new Curve();
            _curve1.SetxData(dataRepo1.BaseGrid, _dimensionFactory);
            _curve1.SetyData(_datColumn1, _dimensionFactory);

            _curve2 = new Curve();
            _curve2.SetxData(dataRepo2.BaseGrid, _dimensionFactory);
            _curve2.SetyData(_datColumn2, _dimensionFactory);

            _chart.AddCurve(_curve1);
            _chart.AddCurve(_curve2);

            sut = new CurveSettingsPresenter(_view, _dimensionFactory, _applicationController);

            A.CallTo(() => _view.BindTo(A <IEnumerable <CurveDTO> > ._))
            .Invokes(x =>
            {
                _allCurveDTOs = x.GetArgument <IEnumerable <CurveDTO> >(0).ToList();
                _curveDTO1    = _allCurveDTOs.FirstOrDefault();
            });

            sut.Edit(_chart);
        }
Exemplo n.º 54
0
        public Main(IApplicationController controller, IMain view, IOperations operations, IMailLogger maillogger, ILogin login, Services.Server.Interfaces.IServer server, IHash hash) : base(controller, view)
        {
            try
            {
                this.operations = operations;
                this.maillogger = maillogger;
                this.login      = login;
                this.server     = server;
                this.hash       = hash;

                logger = LogManager.GetCurrentClassLogger();

                view.StartedProgram += () => StartedProgram();

                logger.Info("Инициализация контроллера авторизации выполнена успешно");
            }
            catch (Exception Ex)
            {
                maillogger.AsyncSendingLog(Ex.ToString());
                View.Error(Ex.Message);
                View.Close();
            }
        }
Exemplo n.º 55
0
        void Initialize()
        {
            var newController = ApplicationController.Create();

            serviceProvider = (TestServiceProvider)ServiceProvider.Create(controller, ServiceType.Test);

            configManagerMock = Substitute.For <IConfigManager>();
            configManagerMock.Subject.Returns(new Action <IApplicationMessage>((IApplicationMessage message) => message.Execute(configManagerMock)));
            serviceProvider.SetConfigManager(configManagerMock);

            mainWindowViewModelMock = Substitute.For <IMainWindowViewModel>();
            mainWindowViewModelMock.Subject
            .Returns(new Action <IApplicationMessage>((IApplicationMessage message) => message.Execute(mainWindowViewModelMock)));
            serviceProvider.SetMainWindowViewModel(mainWindowViewModelMock);

            configWindowViewModelMock = Substitute.For <IConfigWindowViewModel>();
            configWindowViewModelMock.Subject
            .Returns(new Action <IApplicationMessage>((IApplicationMessage message) => message.Execute(configWindowViewModelMock)));
            serviceProvider.SetConfigWindowViewModel(configWindowViewModelMock);

            newController.Initialize(serviceProvider);
            controller = newController;
        }
Exemplo n.º 56
0
        public PersonUserControl(Person person, Form pMdiParent, IApplicationController applicationController)
        {
            _applicationController = applicationController;
            _mdiParent             = pMdiParent;
            Initialization();
            _tempPerson = person;
            InitPrintButton();
            InitializePerson();
            InitializeGroup();
            DisplayProjects(person.Projects);
            DisplaySavings(person.Savings);
            _tempPerson.DateOfBirth            = person.DateOfBirth;
            textBoxIdentificationData.ReadOnly = ServicesProvider.GetInstance().GetGeneralSettings().IsAutomaticID;
            if (ServicesProvider.GetInstance().GetGeneralSettings().IsAutomaticID)
            {
                textBoxIdentificationData.BackColor = Color.WhiteSmoke;
            }

            foreach (var initializer in _applicationController.GetAllInstances <IPersonControlInitializer>())
            {
                initializer.Initialize(this);
            }
        }
Exemplo n.º 57
0
 public MoleculeExpressionTask(IApplicationController applicationController, IExecutionContext executionContext,
                               IIndividualMoleculeFactoryResolver individualMoleculeFactoryResolver,
                               IMoleculeToQueryExpressionSettingsMapper queryExpressionSettingsMapper,
                               IContainerTask containerTask,
                               IProteinExpressionsDatabasePathManager proteinExpressionsDatabasePathManager,
                               IOntogenyRepository ontogenyRepository,
                               ITransportContainerUpdater transportContainerUpdater,
                               ISimulationSubjectExpressionTask <TSimulationSubject> simulationSubjectExpressionTask,
                               IOntogenyTask <TSimulationSubject> ontogenyTask,
                               IMoleculeParameterTask moleculeParameterTask)
 {
     _applicationController             = applicationController;
     _executionContext                  = executionContext;
     _individualMoleculeFactoryResolver = individualMoleculeFactoryResolver;
     _queryExpressionSettingsMapper     = queryExpressionSettingsMapper;
     _containerTask = containerTask;
     _proteinExpressionsDatabasePathManager = proteinExpressionsDatabasePathManager;
     _ontogenyRepository              = ontogenyRepository;
     _transportContainerUpdater       = transportContainerUpdater;
     _simulationSubjectExpressionTask = simulationSubjectExpressionTask;
     _ontogenyTask          = ontogenyTask;
     _moleculeParameterTask = moleculeParameterTask;
 }
        protected override void Context()
        {
            _view = A.Fake <ISimulationCompoundProcessSummaryCollectorView>();
            _applicationController         = A.Fake <IApplicationController>();
            _layoutPresenter               = A.Fake <IConfigurableLayoutPresenter>();
            _eventPublisher                = A.Fake <IEventPublisher>();
            _interactionSelectionPresenter = A.Fake <ISimulationCompoundInteractionSelectionPresenter>();
            _reactionDiagramPresenter      = A.Fake <IReactionDiagramContainerPresenter>();
            sut = new SimulationCompoundProcessSummaryCollectorPresenter(
                _view,
                _applicationController,
                _layoutPresenter,
                _eventPublisher,
                _interactionSelectionPresenter,
                _reactionDiagramPresenter);

            _simulation = A.Fake <Simulation>();
            _individual = new Individual();
            _compound   = new Compound();

            A.CallTo(() => _simulation.Individual).Returns(_individual);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { _compound });
        }
Exemplo n.º 59
0
        static void Main(string[] args)
        {
            View.View view = new View.View();
            view.PrintApplicationInfo();
            view.PrintApplicationOptions();

            var applicationModeView = view.PrintSelectApplicationMode();

            if (applicationModeView == ApplicationModeView.Client)
            {
                view.PrintInformationAboutClientMode();
            }

            if (applicationModeView == ApplicationModeView.Server)
            {
                view.PrintInformationAboutServerMode();
            }

            IApplicationControllerFactory applicationControllerFactory = new ApplicationControllerFactory();
            IApplicationController        applicationController        = applicationControllerFactory.Create(applicationModeView);

            applicationController.Run();
        }
Exemplo n.º 60
0
        static void Main()
        {
            // The very usual Mutex-based single-instance screening
            // 'token' variable is used to store reference to the instance Mutex
            // during the app lifetime
            Program._singleInstanceMutex = Program.GetInstanceToken();

            // If it was not possible to acquire the app token then another app instance is already running
            // Nothing to do here
            if (Program._singleInstanceMutex == null)
            {
                return;
            }

            ExceptionHandler handler = new ExceptionHandler();

            handler.SetupExceptionHandlers();

            IApplicationController controller = Program.InitializeApplicationController();

            Program.InitializeWinForms();
            controller.Run <MainFormPresenter>();
        }