Exemple #1
0
 public EndTransactionMode(IMainController mainController, IMainView mainView, IModeController mode_ctrl)
     : base(new EndTransactionModeInfo())
 {
     this.m_ctrl = mainController;
     this.m_view = mainView;
     this.mode_ctrl = mode_ctrl;
 }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UpgradeForm(IMainView explorerPresenter)
        {
            Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.UpgradeForm.glade", "window1");
            gxml.Autoconnect(this);
            listview1.Model = listmodel;

            CellRendererText textRender = new Gtk.CellRendererText();
            textRender.Editable = false;

            TreeViewColumn column0 = new TreeViewColumn("Version", textRender, "text", 0);
            listview1.AppendColumn(column0);
            column0.Sizing = TreeViewColumnSizing.Autosize;
            column0.Resizable = true;

            TreeViewColumn column1 = new TreeViewColumn("Description", textRender, "text", 1);
            listview1.AppendColumn(column1);
            column1.Sizing = TreeViewColumnSizing.Autosize;
            column1.Resizable = true;

            HTMLview = new HTMLView(new ViewBase(null));
            HTMLalign.Add(HTMLview.MainWidget);
            this.tabbedExplorerView = explorerPresenter;
            button1.Clicked += OnUpgrade;
            button2.Clicked += OnViewMoreDetail;
            window1.Destroyed += OnFormClosing;
            window1.MapEvent += OnShown;
        }
        /// <summary>
        /// Initializes a new instance of the OptionsViewPresenter class.
        /// </summary>
        /// <param name="optionsView">Options view.</param>
        /// <param name="mainView">Main view.</param>
        /// <param name="fileWatcherController">FileWatcherController.</param>
        /// <param name="applicationOptionsController">ApplicationOptionsController.</param>
        /// <exception cref="ArgumentNullException">fileWatcherController is null.</exception>
        public OptionsViewPresenter(IOptionsView optionsView,
            IMainView mainView,
            FileWatcherController fileWatcherController,
            ApplicationOptionsController applicationOptionsController)
        {
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView",
                                                Resources.ArgumentNullException);
            }
            if (optionsView == null)
            {
                throw new ArgumentNullException("optionsView",
                                                Resources.ArgumentNullException);
            }
            if (fileWatcherController == null)
            {
                throw new ArgumentNullException("fileWatcherController",
                                                Resources.ArgumentNullException);
            }
            if (applicationOptionsController == null)
            {
                throw new ArgumentNullException("applicationOptionsController",
                                                Resources.ArgumentNullException);
            }

            _optionsView = optionsView;
            _mainView = mainView;
            _fileWatcherController = fileWatcherController;
            _applicationOptionsController = applicationOptionsController;

            SubscribeToMainViewEvents();
            SubscribeToOptionsViewEvents();
        }
Exemple #4
0
        ///<summary>
        /// Ctor.
        ///</summary>
        ///<param name="attachedView"></param>
        public MainViewController(IMainView attachedView)
        {
            _settingsService = new SettingsService();
            _settingsService.LoadSettings();

            _attachedView = attachedView;

            _timer = new Timer { Enabled = true, Interval = _settingsService.CurrentSettings.Interval * 1000 };

            _timer.Elapsed += TimerElapsed;

            _attachedView.RequestAboutDialog += AttachedViewRequestAboutDialog;
            _attachedView.RequestSync += AttachedViewRequestSync;
            _attachedView.RequestFsxConnect += AttachedViewRequestFsxConnect;
            _attachedView.RequestFscDisconnect += AttachedViewRequestFscDisconnect;
            _attachedView.RequestToggleFsxConnectionState += AttachedViewRequestToggleFsxConnectionState;
            _attachedView.NewMessageArrived += AttachedViewNewMessageArrived;
            _attachedView.TabChanged += AttachedViewTabChanged;

            _attachedView.RequestSettingsLoad += AttachedViewRequestSettingsLoad;
            _attachedView.RequestSettingsReset += AttachedViewRequestSettingsReset;
            _attachedView.RequestSettingsSave += AttachedViewRequestSettingsSave;

            //// set object manager
            //_synchonisationService.SServerPath = _settingsService.CurrentSettings.ServerPath;
            //_synchonisationService.SSimObjectPath = _settingsService.CurrentSettings.SimObjectsPath;

            // set operator
            Staticfuncs.Serverpath = _settingsService.CurrentSettings.ServerPath;

            InitView();
        }
 public MainController(IMainView view,
     IFileWatcherService fileWatcherService)
 {
     FileWatcherService = fileWatcherService;
     View = view;
     PrepareUI();
 }
	    public MainPresenter (IMainView mainView)
		{
            this._mainView = mainView;
			initialize();
            var test = ConfigurationManager.AppSettings;
            AddUpdateAppSettings("test", "config 1");
		}
        public MainController(IMainView view, IMainModel model)
        {
            _view = view;
            _model = model;

            InitializeViewEvents();
        }
Exemple #8
0
        public MainPresenter()
        {
            m_view = new MainView();
            UpdateExamples();
            SetMenuLangugage();

            #region Add handlers to events

            m_view.BrowseClicked += Browse;
            m_view.RefreshClicked += Refresh;
            m_view.PreviewClicked += ShowPreview;
            m_view.GraphvizClicked += Graphviz;
            m_view.WinGraphvizClicked += WinGraphvizClicked;
            m_view.SaveAsClicked += SaveAsClicked;
            m_view.AboutClicked += AboutBoxClicked;
            m_view.CloseClicked += CloseClicked;
            m_view.OpenClicked += OpenClicked;
            m_view.SaveClicked += SaveClicked;
            m_view.NewClicked += NewClicked;

            m_view.LanguageClicked += LanguageClicked;
            m_view.ExampleClicked += ExampleClicked;

            #endregion
        }
        public MainPresenter(IMainView view)
        {
            if (view == null) {
            throw new ArgumentNullException("view");
             }
             // Load configuration
             this.configuration = Configuration.Load();
             // Initialize recorder
             this.displayProvider = new DisplayProvider();
             this.displaySettings = new DisplaySettings() {
            Mouse = this.displayProvider.MouseSettings,
            Tracking = this.displayProvider.TrackingSettings,
            Watermark = this.displayProvider.WatermarkSettings,
             };
             this.soundProvider = new SoundProvider();
             this.soundSettings = new SoundSettings() {
            DeviceId = this.soundProvider.DeviceId,
            Format = this.soundProvider.Format,
             };
             this.recorder = new Recorder();
             this.recorder.Error += new RecordErrorEventHandler(recorder_Error);

             // Initialize view
             this.view = view;
             this.InitializeView();

             // Apply configuration
             this.ApplyConfiguration(null);

             // Update View
             this.view.AllowUpdate = true;
             // this.UpdateView();
        }
 public MainPresenter(IMainView view)
 {
     _view = view;
     _view.IncomeFileTypes = Global.Instance.IncomeFileTypes;
     _view.ConvertClick += OnConvertClick;
     _view.StopClick += OnStopClick;
 }
 public ProjectView(IProjectPresenter presenter, IMainView parentView)
     : base(parentView)
 {
     this.presenter = presenter;
     InitializeComponent();
     BindProject();
 }
 public MainPresenter(IMainView view)
 {
     _view = view;
     _view.OnFileOpen += _view_OnFileOpen;
     _view.OnItemSelect += _view_OnItemSelect;
     _view.OnAboutSelect += _view_OnAboutSelect;
 }
        public void CreatePresenter()
        {
            View = Substitute.For<IMainView>();
            Model = Substitute.For<ITestModel>();

            Presenter = new MainPresenter(View, Model);
        }
Exemple #14
0
 public PaymentMode(IMainController mainController, IMainView mainView, IModeController mode_ctrl)
     : base(new PaymentModeInfo())
 {
     this.m_ctrl = mainController;
     this.m_view = mainView;
     this.mode_ctrl = mode_ctrl;
 }
 public bool? ShowDialog(IMainView owner)
 {
     _blnIsDialog = true;
     this.Owner = owner as Window;
     this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     return this.ShowDialog();
 }
Exemple #16
0
 public SelectItemMode(IMainController mainController, IMainView mainView, IModeController mode_ctrl)
     : base(new SelectItemModeInfo())
 {
     this.m_ctrl = mainController;
     this.m_view = mainView;
     this.mode_ctrl = mode_ctrl;
 }
 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);
 }
        public ImageAcquisition( IMainView mainView )
        {
            _mainView = mainView;
            _mainView.InitializeHalconEvent += _mainView_InitializeHalconEvent;
            _mainView.TriggerCameraEvent += ( sender, args ) => GrabImagesAndDisplay( );

            _halconImageControllerDictionary = new Dictionary< string, HalconImageController >( );
        }
Exemple #19
0
 public ScanMode(IMainController mainController, IMainView mainView, IModeController mode_ctrl, ISearchPartView searchPart_view)
     : base(new ScanModeInfo())
 {
     this.m_ctrl = mainController;
     this.m_view = mainView;
     this.mode_ctrl = mode_ctrl;
     this.searchPart_view = searchPart_view;
 }
        public MainPresenter(IProjectModel model, IMainView view)
        {
            _model = model;
            _view = view;

            InitializeView();
            WireUpEvents();
        }
Exemple #21
0
        public MainPresenter(IMainView view, ITestModel model)
        {
            _view = view;
            _model = model;

            InitializeMainMenu();
            WireUpEvents();
        }
        public void ShowView()
        {
            _view = ObjectRegistry.Create<IMainView>();
            _viewModel = ObjectRegistry.Create<MainViewModel>();
            _viewModel.Presenter = this;

            _view.ShowView(_viewModel);
        }
        public MainPresenter(IMainView mainView, FoodTracker foodTracker)
        {
            MainView = mainView;
            FoodTracker = foodTracker;
            FoodPresenter = new FoodPresenter(MainView.FoodView, FoodTracker);
            CategoryPresenter = new CategoryPresenter(MainView.CategoryView, FoodTracker);

        }
 public MainViewModel(IMainView view)
 {
     View = view;
     Recipes = new ObservableCollection<RecipeViewModelState>();
     AddNewRecipeCommand = new DelegateCommand(OnAddNewRecipe);
     ReloadCommand = new DelegateCommand(OnReload);
     view.SetContext(this);
 }
Exemple #25
0
 public ModeController(IMainController mainController, IMainView m_view, ISearchPartView searchPartView)
 {
     this.m_view = m_view;
     this.mode_scan = new ScanMode(mainController, m_view, this, searchPartView);
     this.mode_selectItem = new SelectItemMode(mainController, m_view, this);
     this.mode_payment = new PaymentMode(mainController, m_view, this);
     this.mode_searchPartByGroup = new SearchPartMode(mainController, searchPartView, this);
     this.mode_endTransaction = new EndTransactionMode(mainController, m_view, this);
 }
 public FundPresenter(IMainView view, IFundRepository fundRepository)
 {
     m_View = view;
     FundRepository = fundRepository;
     funds = FundRepository.FindAll();
     m_View.LoadFunds(FundRepository.FindAll());
     FundSummary();
     m_View.DataSourceChange += M_View_DataSourceChange;
 }
Exemple #27
0
		public MainPresenter(IMainView view)
		{
			SyncContext = SynchronizationContext.Current;

			View = view;

			_clients = new List<Client>();
			_bindingSourceClients = new BindingSource();
			_bindingSourceClients.DataSource = null;
			_bindingSourceClients.DataSource = _clients;

			_logs = new List<Log>();
			_bindingSourceLogs = new BindingSource();
			_bindingSourceLogs.DataSource = null;
			_bindingSourceLogs.DataSource = _logs;

			_gkLifecycles = new System.ComponentModel.BindingList<GKLifecycle>();
			_bindingSourceLifecycle = new BindingSource();
			_bindingSourceLifecycle.DataSource = null;
			_bindingSourceLifecycle.DataSource = _gkLifecycles;
			GKLifecycleManager.GKLifecycleChangedEvent += On_GKLifecycleChangedEvent;

			ClientPolls = new List<ClientPolling>();
			_bindingSourceClientPolls = new BindingSource();
			_bindingSourceClientPolls.DataSource = null;
			_bindingSourceClientPolls.DataSource = ClientPolls;

			ServerTasks = new List<ServerTaskModel>();
			_bindingSourceOperations = new BindingSource();
			_bindingSourceOperations.DataSource = null;
			_bindingSourceOperations.DataSource = ServerTasks;

			License = new License();
			License.LicenseChanged += EventHandler_License_LicenseChanged;

			View.Title = "Сервер приложений Глобал";
			View.CommandDisconnectActivated += EventHandler_View_CommandDisconnectActivated;
			View.ClientsContext = _bindingSourceClients;
			View.EnableMenuDisconnect = false;
			View.LogsContext = _bindingSourceLogs;
			View.GkLifecyclesContext = _bindingSourceLifecycle;
			View.ClientPollsContext = _bindingSourceClientPolls;
			View.OperationsContext = _bindingSourceOperations;
			View.LicenseMode = License.LicenseInfo.LicenseMode;
			View.RemoteClientsCount = License.LicenseInfo.RemoteClientsCount;
			View.HasFirefighting = License.LicenseInfo.HasFirefighting;
			View.HasGuard = License.LicenseInfo.HasGuard;
			View.HasSKD = License.LicenseInfo.HasSKD;
			View.HasVideo = License.LicenseInfo.HasVideo;
			View.HasOpcServer = License.LicenseInfo.HasOpcServer;
			View.InitialKey = License.InitialKey;
			View.ClickLoadLicense += EventHandler_View_ClickLoadLicense;

			LastLog = String.Empty;
			Current = this;
		}
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            _mainView = new MainWindow();

            _mainView.DataContext = new MainViewModel(new DataCenterRepository());

            _mainView.Show();
        }
        public MainPresenter(IMainView view, IQueueConnector connector)
        {
            _view = view;

            _listener = connector.SubscribeTo<ScannerPulse>("Notifications", "Scanner.Pulse", OnScannerPulse);
            _connector = connector;

            _view.StartClicked += OnStartClicked;
            _view.StopClicked += OnStopClicked;
        }
 public MainViewModel(IMainView view, CompositionContainer compositionContainer)
 {
     View = view;
     View.ViewModel = this;
     ShellContainer = compositionContainer;
     ViewDispatcher = ((IMainView)View).ViewDispatcher;
     CloseCommand = new CommandHandler<object, object>(CloseCommandAction);
     HardwareView = HardwareViewModel.View as UserControl;
     BranchView = BranchViewModel.View as UserControl;
 }
Exemple #31
0
 public MainViewModel(IMainView mainView)
 {
     this.mainView = mainView;
     Initialize();
 }
Exemple #32
0
 public EditMoleculesBuildingBlockView(IMainView mainView) : base(mainView)
 {
     InitializeComponent();
 }
 public void Initialize()
 {
     view      = Substitute.For <IMainView>();
     doc       = new ProjectDocument();
     presenter = new MainPresenter(doc, view);
 }
Exemple #34
0
 public MainPresenter(IMainView view, IMainModel model)
 {
     _view  = view;
     _model = model;
     HookViewEvents();
 }
Exemple #35
0
 public EditMoleculeStartValuesView(IMainView mainView) : base(mainView)
 {
     InitializeComponent();
 }
        private int RunInternal(string[] args)
        {
            CefRuntime.Load();

            var settings = new CefSettings();

            settings.MultiThreadedMessageLoop = MultiThreadedMessageLoop = CefRuntime.Platform == CefRuntimePlatform.Windows;
            settings.LogSeverity         = CefLogSeverity.Verbose;
            settings.LogFile             = "cef.log";
            settings.RemoteDebuggingPort = 20480;
            settings.NoSandbox           = true;

            var argv = args;

            if (CefRuntime.Platform != CefRuntimePlatform.Windows)
            {
                argv = new string[args.Length + 1];
                Array.Copy(args, 0, argv, 1, args.Length);
                argv[0] = "-";
            }

            var mainArgs = new CefMainArgs(argv);
            var app      = new DemoCefApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, app, IntPtr.Zero);

            Console.WriteLine("CefRuntime.ExecuteProcess() returns {0}", exitCode);
            if (exitCode != -1)
            {
                return(exitCode);
            }

            // guard if something wrong
            foreach (var arg in args)
            {
                if (arg.StartsWith("--type="))
                {
                    return(-2);
                }
            }

            CefRuntime.Initialize(mainArgs, settings, app, IntPtr.Zero);

            RegisterSchemes();
            RegisterMessageRouter();

            PlatformInitialize();

            var mainMenu = CreateMainMenu();

            _mainView = CreateMainView(mainMenu);
            _mainView.NewTab(HomeUrl);

            PlatformRunMessageLoop();

            _mainView.Dispose();
            _mainView = null;

            CefRuntime.Shutdown();

            PlatformShutdown();
            return(0);
        }
        public MainPresenter()
        {
            _view = new MainView();

            // Inisialisai data class RoleManager
            RoleManager.MenuStrip = _view.MenuStrip;
            RoleManager.ToolStrip = _view.ToolStrip;
            RoleManager.RoleKode  = MainProgram.UserActive.role_kode;

            var roleManager = new RoleManager();

            // DEVELOPER MODE
            //
            // AKtifkan pemanggilan method dibawah ini untuk mereset data pada tabel form_action dan role_detail ketika anda menambahkan Menu, Form, atau control baru,
            // jangan lupa nonaktifkan kembali, agar tidak melakukan reset setiap kali aplikasi dijalankan.
            //
            // roleManager.ResetFormAction(Assembly.GetExecutingAssembly());

            // Enable/Disable MenuStrip dan ToolStrip sesuai Role operator
            roleManager.PopulateRoleDetailToMenuStripAndToolStrip();

            _view.OnViewLoad += _view_OnViewLoad;
            // Operasi
            _view.OnLogOutClick            += _view_OnLogOutClick;
            _view.OnGantiPasswordViewClick += _view_OnGantiPasswordViewClick;
            // Master
            _view.OnTipeViewClick      += _view_OnTipeViewClick;
            _view.OnSubTipeViewClick   += _view_OnSubTipeViewClick;
            _view.OnSupplierViewClick  += _view_OnSupplierViewClick;
            _view.OnBarangViewClick    += _view_OnBarangViewClick;
            _view.OnSatuanViewClick    += _view_OnSatuanViewClick;
            _view.OnPelangganViewClick += _view_OnPelangganViewClick;
            _view.OnUserViewClick      += _view_OnUserViewClick;
            _view.OnRoleViewClick      += _view_OnRoleViewClick;
            // Data
            _view.OnPenyesuaianStokViewClick   += _view_OnPenyesuaianStokViewClick;
            _view.OnHutangOperasionalViewClick += _view_OnHutangOperasionalViewClick;
            // Transaksi
            _view.OnKasAwalViewClick         += _view_OnKasAwalViewClick;
            _view.OnPenjualanViewClick       += _view_OnPenjualanViewClick;
            _view.OnPembelianViewClick       += _view_OnPembelianViewClick;
            _view.OnPengeluaranViewClick     += _view_OnPengeluaranViewClick;
            _view.OnReturnPenjualanViewClick += _view_OnReturnPenjualanViewClick;
            _view.OnReturnPembelianViewClick += _view_OnReturnPembelianViewClick;
            // Laporan
            _view.OnLaporanPenjualanViewClick           += _view_OnLaporanPenjualanViewClick;
            _view.OnLaporanPembelianViewClick           += _view_OnLaporanPembelianViewClick;
            _view.OnLaporanPengeluaranViewClick         += _view_OnLaporanPengeluaranViewClick;
            _view.OnLaporanTransaksiByDateViewClick     += _view_OnLaporanTransaksiByDateViewClick;
            _view.OnLaporanReturnPenjualanViewClick     += _view_OnLaporanReturnPenjualanViewClick;
            _view.OnLaporanReturnPembelianViewClick     += _view_OnLaporanReturnPembelianViewClick;
            _view.OnLaporanStatusBarangViewClick        += _view_OnLaporanStatusBarangViewClick;
            _view.OnLaporanStatusPerBarangViewClick     += _view_OnLaporanStatusPerBarangViewClick;
            _view.OnLaporanGrafikBarangTerjualViewClick += _view_OnLaporanGrafikBarangTerjualViewClick;
            _view.OnLaporanLabaRugiViewClick            += _view_OnLaporanLabaRugiViewClick;
            // Database
            _view.OnBackupDatabaseViewClick  += _view_OnBackupDatabaseViewClick;
            _view.OnRestoreDatabaseViewClick += _view_OnRestoreDatabaseViewClick;
            // Alat
            _view.OnPengaturanViewClick += _view_OnPengaturanViewClick;
            // Bantuan
            _view.OnTentangViewClick += _view_OnTentangViewClick;
        }
        public MainFormPresenter(IMainView view, ISharedViewState sharedViewState, IApplicationManager applicationManager)
        {
            _view               = view;
            _sharedViewState    = sharedViewState;
            _applicationManager = applicationManager;


            //  _view.EnterClicked += (o, e) => _sharedViewState.CurrentAction?.Invoke(o, e);


            _view.ModeForcedToReal += (sender, args) =>
            {
                //   SetMode(CalculationsMode.Real);
                EventAggregator.Instance.Publish(new CalculationsModeChangedEvent(CalculationsMode.Real));
            };
            _view.ModeForcedToComplex += (sender, args) =>
            {
                //  SetMode(CalculationsMode.Complex);
                EventAggregator.Instance.Publish(new CalculationsModeChangedEvent(CalculationsMode.Complex));
            };
            _view.ModeForcedToFxy += (sender, args) =>
            {
                //  SetMode(CalculationsMode.Fxy);
                EventAggregator.Instance.Publish(new CalculationsModeChangedEvent(CalculationsMode.Fxy));
            };

            EventAggregator.Instance.Subscribe <CalculationsModeChangedEvent>(mode => SetMode(mode.CalculationsMode));

            Settings.Default.PropertyChanged += (o, e) =>
            {
                switch (e.PropertyName)
                {
                case nameof(Settings.Default.Language):
                    _applicationNeedRestart = !Equals(CultureInfo.CurrentCulture, Settings.Default.Language);
                    break;
                }
            };

            Settings.Default.SettingsSaving += (o, e) =>
            {
                if (_applicationNeedRestart)
                {
                    _applicationNeedRestart = false;
                    Task.Factory.StartNew(() => { Thread.Sleep(400); _applicationManager.Restart(); });
                }
            };

            ///////EventAggregator.Instance.Subscribe<ChangeViewEvent>(cv => { _view.SelectedViewIndex = (int) cv.View; });

            _sharedViewState.PropertyChanged += (o, e) =>
            {
                switch (e.PropertyName)
                {
                case nameof(_sharedViewState.CurrentView):
                    _view.SelectedViewIndex = (int)_sharedViewState.CurrentView;
                    break;
                }
            };

            _view.SelectedViewChanged += _view_SelectedViewChanged;

            _view.StatusText = GlobalConfig.Version;
        }
 public MainViewPresenter(IMainView view, WorkerController wc)
 {
     View = view;
     worker = wc;
 }
Exemple #40
0
 //******************************************************************************
 //
 // Method: Presenter (constructor)
 //
 //******************************************************************************
 /// <summary>
 /// Initialises a new instance of the SampleApplication4.Presenter class.
 /// </summary>
 /// <param name="mainView">The main view to associate with the presenter.</param>
 /// <param name="model">The model layer to associate with the presenter.</param>
 public Presenter(IMainView mainView, IModel model)
 {
     this.mainView = mainView;
     this.model    = model;
     exitInitiated = false;
 }
Exemple #41
0
 public AddRequestPresenter(IMainView view)
 {
     this.mainView = view;
 }
 public EditSimulationSettingsView(IMainView mainView) : base(mainView)
 {
     InitializeComponent();
 }
Exemple #43
0
 public MainPresenter(IMainView view)
 {
     _model = new PolygraphicItemListModel();
     _view  = view;
 }
Exemple #44
0
 public void Run(IMainView view)
 {
     Application.Run((Form)view);
 }
Exemple #45
0
 public MainController(IMainView view)
 {
     this.view    = view;
     communicator = new ServerCommunicator();
 }
 public void SetView(IMainView view)
 {
     this._view = view;
 }
Exemple #47
0
        const int ADCmax = 0xB96400;//0xC35000;//

        public MainPresenter(ISerial serial, IMainView view, IFileWorker fileWorker)
        {
            Serial     = serial;
            View       = view;
            FileWorker = fileWorker;

            Requests = new Requests(Serial);
            Record   = new Record();

            var    Ch1Packs = new List <double>();
            var    Ch2Packs = new List <double>();
            object SyncObj  = new object();

            Stopwatch stopwatch = new Stopwatch();

            Requests.MeasureDataHandler += data =>
            {
                stopwatch.Stop();
                var delta = stopwatch.ElapsedMilliseconds; // Время между посылками
                lock (SyncObj)
                {
                    Ch1Packs.Add(((data[0] - ADCmax / 2) * View.K_Ch1) / ADCmax);
                    Ch2Packs.Add(((data[1] - ADCmax / 2) * View.K_Ch2) / ADCmax);
                }
                stopwatch.Restart();
            };

            #region Serial Port
            int counter = 0;
            var timer   = new Timer();
            timer.Interval = (int)(TimeStep * 1000);
            timer.Tick    += (sender, args) =>
            {
                lock (SyncObj)
                {
                    int d;
                    if (!Serial.IsConnected)
                    {
                        Ch1Packs.Clear();
                        Ch2Packs.Clear();
                        d = (int)(TimeStep * Fd);
                        for (int i = 0; i < d; i++)
                        {
                            counter++;
                            Ch1Packs.Add(Math.Sin(counter * 4 * Math.PI / Record.Ch1.Length));
                            Ch2Packs.Add(Math.Cos(counter * 4 * Math.PI / Record.Ch1.Length));
                        }
                    }
                    else
                    {
                        d = Ch1Packs.Count;
                    }

                    for (int i = 0; i < Record.Ch1.Length - d; i++)
                    {
                        Record.Ch1[i] = Record.Ch1[i + d];
                        Record.Ch2[i] = Record.Ch2[i + d];
                    }
                    for (int i = 0; i < d; i++)
                    {
                        Record.Ch1[Record.Ch1.Length - d + i] = Ch1Packs[i];
                        Record.Ch2[Record.Ch1.Length - d + i] = Ch2Packs[i];
                    }
                    Ch1Packs.Clear();
                    Ch2Packs.Clear();
                }
                View.UpdateChart(Record);
            };

            View.AvailablePorts = Serial.AvailablePorts;
            View.RefreshPorts  += () => View.AvailablePorts = Serial.AvailablePorts;

            View.ConnectToDevice += () =>
            {
                if (!Serial.IsConnected)
                {// Открытие порта
                    Serial.Connect(View.ComPort, View.BaudRate,
                                   error => View.ErrorHandler("Ошибка открытия порта", error));
                }
                else
                {// Закрытие порта
                    Serial.Disconnect(
                        error => View.ErrorHandler("Ошибка закрытия порта", error));
                }
            };
            Serial.ConnectionChanged += state => View.IsConnected = state;
            #endregion

            View.Exit += () =>
            {
                Serial.Disconnect(error => View.ErrorHandler("Ошибка закрытия порта", error));
                View.Close();
            };

            View.LoadRecord += () =>
            {
                var record = FileWorker.LoadRecord(
                    error => View.ErrorHandler("Ошибка открытия файла", error));
                if (record == null)
                {
                    return;
                }
                Record = record;
                View.UpdateChart(Record);
            };

            View.SaveRecord += () =>
            {
                FileWorker.SaveSeries(Record,
                                      error => View.ErrorHandler("Ошибка сохранения файла", error));
            };

            View.StartRecord += () =>
            {
                var T = View.RecordDuration;
                Record.Ch1 = new double[(int)(T * Fd)];
                Record.Ch2 = new double[(int)(T * Fd)];
                Serial.FlushRxBuffer();
                Requests.StartMeasure();
                timer.Start();
            };

            View.StopRecord += () =>
            {
                Requests.StopMeasure();
                timer.Stop();
            };
        }
Exemple #48
0
 public MainViewModel(IMainView View)
 {
     this.View = View;
 }
 public MainPresenterTestInt(IMainView view)
     : base(view)
 {
 }
Exemple #50
0
 public MainPresenter(IMainView mainView)
 {
     this.mainView  = mainView;
     this.mainModel = new MainModel();
 }
Exemple #51
0
 public void CreateView()
 {
     _view = new MainForm();
 }
Exemple #52
0
 public Presenter(IMainView iView, Model iDataService)
 {
     view  = iView;
     model = iDataService;
 }
Exemple #53
0
 public ResultsViewModel(IMainView mainView, IEnumerable <ResizeError> errors)
 {
     _mainView    = mainView;
     Errors       = errors;
     CloseCommand = new RelayCommand(Close);
 }
 public MainPresenter(IMainView view)
 {
     this.view = view;
 }
Exemple #55
0
 public MainPresenter(IMainView view, IMessageService messageService, IUserSettings userSettings)
     : this(view, messageService, null, userSettings)
 {
 }
Exemple #56
0
 public MainPresenter(IMainView view)
 {
     mainView   = view;
     signInView = new SignInSubPresenter(view.SignInControl);
     signUpView = new SignUpSubPresenter(view.SignUpControl);
 }
Exemple #57
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////
        #region Constructors

        public TfsAccessor(IMainView mainView)
        {
            _mainView    = mainView;
            _machineName = Environment.MachineName;
            _retries     = 1;
        }
Exemple #58
0
 public OutputSelectionsView(IMainView shell)
     : base(shell)
 {
     InitializeComponent();
 }
 public void SetView(IMainView view)
 {
     m_view = view;
 }
 private void updateMinimumSize(IMainView activeView)
 {
     this.MinHeight = this.WindowHeaderHeight + activeView.MinHeight;
     this.MinWidth  = activeView.MinWidth;
 }