Example #1
0
        public void StartApplication()
        {
            // stuff the config with a default config, makes it easy to save out
            // a blank config.
            MakeDefaultBlockConfig();

            // ask the remoting system for access to the EDMHardwareController
            RemotingConfiguration.RegisterWellKnownClientType(
                Type.GetType("EDMHardwareControl.Controller, EDMHardwareControl"),
                "tcp://localhost:1172/controller.rem"
                );

            // ask the remoting system for access to ScanMaster
            RemotingConfiguration.RegisterWellKnownClientType(
                Type.GetType("ScanMaster.Controller, ScanMaster"),
                "tcp://localhost:1170/controller.rem"
                );

            // ask the remoting system for access to PhaseLock
            RemotingConfiguration.RegisterWellKnownClientType(
                Type.GetType("EDMPhaseLock.MainForm, EDMPhaseLock"),
                "tcp://localhost:1175/controller.rem"
                );

            mainWindow = new MainWindow(this);
            acquisitor = new Acquisitor();
            mainWindow.textArea.Text = "BlockHead!" + Environment.NewLine;

            liveViewer = new LiveViewer(this);
            liveViewer.Show();

            Application.Run(mainWindow);
        }
        public MainWindowViewModel(IDeviceValidator validator, INotificationService notificationService, IWindowManager manager)
        {
            this.validator           = validator;
            this.logger              = new TextLogger("../../../log.txt", true);
            this.notificationService = notificationService;
            Items             = new ObservableCollection <Device>();
            Connected         = false;
            this.manager      = manager;
            LogCommand        = new GUIICommand(ShowLogs);
            commandExecutor   = new CommandExecutor(logger);
            commandProcessor  = new CommandProcessor(notificationService, validator, commandExecutor, logger);
            alarmProcessor    = new AlarmProcessor(logger);
            automationManager = new AutomationManager(commandExecutor, Items, logger);


            try
            {
                LoadFromConfiguration();
                factory      = new ChannelFactory <IService>(new NetTcpBinding(), $"net.tcp://localhost:{servicePort}/WCFService");
                proxy        = factory.CreateChannel();
                Connected    = false;
                UpdateEvent += MainWindowViewModel_UpdateEvent;
                acquisitor   = new Acquisitor(Items, acquisitionInterval, factory, commandExecutor, logger, automationManager);
            }
            catch (Exception ex)
            {
                notificationService.ShowNotification("Server", $"Error: {ex.Message}, ST: {ex.StackTrace}", Notifications.Wpf.NotificationType.Error);
            }
        }
Example #3
0
        // This function is called at the very start of application execution.
        public void StartApplication()
        {
            // make an acquisitor and connect ourself to its events
            acquisitor               = new Acquisitor();
            acquisitor.Data         += new DataEventHandler(DataHandler);
            acquisitor.ScanFinished += new ScanFinishedEventHandler(ScanFinishedHandler);

            // ask the remoting system for access to the EDMHardwareController
            //RemotingConfiguration.RegisterWellKnownClientType(
            //    Type.GetType("EDMHardwareControl.Controller, EDMHardwareControl"),
            //    "tcp://localhost:1172/controller.rem"
            //    );

            controllerWindow = new ControllerWindow(this);
            controllerWindow.Show();

            // initialise the profile manager
            profileManager.Window = controllerWindow;
            profileManager.Start();

            // try to load in the last profile set
            // first deserialize the profile set path
            //try
            //{
            //    BinaryFormatter bf = new BinaryFormatter();
            //    String settingsPath = (string)Environs.FileSystem.Paths["settingsPath"];
            //    String filePath = settingsPath + "\\ScanMaster\\profilePath.bin";
            //    FileStream fs = File.Open(filePath, FileMode.Open);
            //    lastProfileSetPath = (string)bf.Deserialize(fs);
            //    fs.Close();
            //}
            //catch (Exception)
            //{
            //    Console.Error.WriteLine("Couldn't find saved profile path");
            //}
            //try
            //{
            //    if (lastProfileSetPath != null) LoadProfileSet(lastProfileSetPath);
            //}
            //catch (Exception e)
            //{
            //    Console.Error.WriteLine("Couldn't load last profile set");
            //    Console.Error.WriteLine(e.Message);
            //}

            // initialise the parameter helper
            parameterHelper = new ParameterHelper();
            parameterHelper.Initialise();

            // connect the acquisitor to the profile manager, which will send it events when the
            // user is in tweak mode.
            profileManager.Tweak += new TweakEventHandler(acquisitor.HandleTweak);

            // Get access to any other applications required
            Environs.Hardware.ConnectApplications();

            // run the main event loop
            Application.Run(controllerWindow);
        }
Example #4
0
 public MainViewModel()
 {
     commandExecutor = new FunctionExecutor(this);
     this.acquisitor = new Acquisitor(acquisitionTrigger, this.commandExecutor, this);
     InitializePointCollection();
     InitializeAndStartThreads();
     logBuilder                = new StringBuilder();
     ConnectionState           = ConnectionState.DISCONNECTED;
     Thread.CurrentThread.Name = "Main Thread";
 }
Example #5
0
 public void Start()
 {
     if (!started)
     {
         functionExecutor  = new FunctionExecutor();
         processingManager = new ProcessingManager(functionExecutor);
         acquisitor        = new Acquisitor(processingManager);
         started           = true;
     }
 }
Example #6
0
 public FEP()
 {
     if (!started)
     {
         functionExecutor  = new FunctionExecutor();
         processingManager = new ProcessingManager(functionExecutor);
         acquisitor        = new Acquisitor(processingManager);
         commandingService = new CommandingService(processingManager);
         started           = true;
     }
 }
Example #7
0
 public DComCore()
 {
     configuration          = new ConfigReader();
     commandExecutor        = new FunctionExecutor(this, configuration);
     this.processingManager = new ProcessingManager(this, commandExecutor);
     this.acquisitor        = new Acquisitor(acquisitionTrigger, this.processingManager, this, configuration);
     this.automationManager = new AutomationManager(this, processingManager, automationTrigger, configuration);
     InitializePointCollection();
     InitializeAndStartThreads();
     logBuilder = new StringBuilder();
     Thread.CurrentThread.Name = "Main Thread";
 }
Example #8
0
        public MainViewModel()
        {
            configuration          = new ConfigReader();
            commandExecutor        = new FunctionExecutor(this, configuration);
            this.processingManager = new ProcessingManager(this, commandExecutor);
            this.acquisitor        = new Acquisitor(acquisitionTrigger, this.processingManager, this, configuration);
            this.automationManager = new AutomationManager(this, processingManager, automationTrigger, configuration);
            var thread = new Thread(StartWCFServer);

            thread.Name = "WCF Server";
            thread.Start();
            InitializePointCollection();
            InitializeAndStartThreads();
            logBuilder                = new StringBuilder();
            ConnectionState           = ConnectionState.DISCONNECTED;
            Thread.CurrentThread.Name = "Main Thread";
        }