Beispiel #1
0
        public void GoToStage(Stage stage)
        {
            stage_ = stage;
            _controlHolder.Children.Clear();
            switch (stage_)
            {
            case Stage.SetupSource:
                _controlHolder.Children.Add(new SetupSourceControl(this));
                break;

            case Stage.SetupCameraParameters:
                _controlHolder.Children.Add(new SetupCameraParametersControl(this));
                break;

            case Stage.SelectCalibration:
                _controlHolder.Children.Add(new SetupCalibrationControl(this));
                break;

            case Stage.Calibrate:
                var calibrateWindow = new CalibrationWindow(Controller);
                calibrateWindow.Show();
                Close();
                break;

            case Stage.Main:
                var mainwindow = new MainWindow(Controller);
                mainwindow.Show();
                Close();
                break;
            }
            SetMessage(string.Empty);
        }
        private void OpenCalibrationWindow(object obj)
        {
            MessageWriter.LogWrite("Opening calibration window...");
            CalibrationWindow cal = new CalibrationWindow();

            cal.Show();
        }
Beispiel #3
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            Glide.FitToScreen = true;
            Glide.Keyboard = Helper.InitKeyboard();

            GlideTouch.Initialize();

            Glide.MainWindow = new SplashScreen();
            Thread.Sleep(4000);

            if (!GlideTouch.Calibrated)
            {
                CalibrationWindow calWindow = new CalibrationWindow(false, true);
                calWindow.CloseEvent += new OnClose(calWindow_CloseEvent);
                Glide.MainWindow = calWindow;
            }
            else
            {
                Glide.MainWindow = new HomeWindow();
            }

            try
            {
                sdCard.MountSDCard();
            }
            catch
            {
                Glide.MessageBoxManager.Show("There was a problem loading the SD Card.");
            }
            Debug.Print("Program Started");
        }
Beispiel #4
0
        public GraphicsManager(int width, int height)
        {
            //mouseManager = new MouseManager(canvas);
            //mouseManager.OnMouseDblClick = InterceptMouseDblClick;
            //mouseManager.OnMouseDown = InterceptMouseDown;
            //mouseManager.OnMouseUp = InterceptMouseUp;
            //mouseManager.OnMouseMove = InterceptMouseMove;
            //mouseManager.OnMouseOut = InterceptMouseOut;

            TouchManager.TouchDown           += new TouchEventHandler(TouchManager_TouchDown);
            TouchManager.TouchMove           += new TouchEventHandler(TouchManager_TouchMove);
            TouchManager.TouchUp             += new TouchEventHandler(TouchManager_TouchUp);
            TouchManager.TouchGestureStarted += new TouchGestureEventHandler(TouchManager_TouchGestureStarted);
            TouchManager.TouchGestureChanged += new TouchGestureEventHandler(TouchManager_TouchGestureChanged);
            TouchManager.TouchGestureEnded   += new TouchGestureEventHandler(TouchManager_TouchGestureEnded);
            TouchManager.Initialize();

            bitmap  = new Bitmap(width, height);
            desktop = new Desktop(width, height, this);
            cw      = new CalibrationWindow(width, height, this)
            {
                Background   = new SolidColorBrush(Color.CornflowerBlue),
                CrosshairPen = new Pen(Color.Red, 1)
            };

            if (CalibrationManager.IsCalibrated)
            {
                CalibrationManager.ApplyCalibrationPoints();
            }

            desktop.Invalidate();
        }
        /// <summary>
        /// Perform Calibration Button shows Calibration Window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PerformCalibration_B_Click(object sender, RoutedEventArgs e)
        {
            //Hide Main Window
            this.Hide();

            //Calibration window
            calibrationWindow = new CalibrationWindow(this, controller);

            //Show Calibration Window
            calibrationWindow.ShowDialog();
        }
        public void StopKinect()
        {
            if (CalibrationWindow != null)
            {
                CalibrationWindow.Close();
            }
            ShowStatus(GreenResources.StatusStopping, true);
            BackgroundWorker StopWorker = new BackgroundWorker();

            StopWorker.DoWork             += StopWorker_DoWork;
            StopWorker.RunWorkerCompleted += StopWorker_RunWorkerCompleted;
            StopWorker.RunWorkerAsync();
        }
Beispiel #7
0
        public void showCalibration()
        {
            if (calibrationWindow == null)
            {
                calibrationWindow = new CalibrationWindow()
                {
                    Top = 0, Left = 0, WindowStartupLocation = WindowStartupLocation.Manual
                }
            }
            ;

            calibrationWindow.Width  = screenSource.getWidth();
            calibrationWindow.Height = screenSource.getHeight();

            calibrationWindow.Show();
            this.Owner = calibrationWindow;
            this.Focus();
        }
Beispiel #8
0
        /// <summary>
        /// Starts the touch calibration
        /// </summary>
        /// <param name="cc">Configuration to use when calibrating the screen</param>
        /// <remarks>
        /// This will show the touch calibration window.
        /// </remarks>
        public static void CalibrateTouch(CalibrationConfiguration cc)
        {
            IContainer prv = Core.ActiveContainer;
            var        cw  = new CalibrationWindow(cc);

            Core.ActiveContainer = cw;

            _activeBlock = new ManualResetEvent(false);
            _activeBlock.Reset();

            while (!_activeBlock.WaitOne(1000, false))
            {
            }

            _activeBlock = null;

            Core.ActiveContainer = prv;
        }
Beispiel #9
0
        protected override void Run()
        {
            if (!Utils.IsEmulator)
            {
                bool reboot = false;
                reboot |= LCDManager.SetLCDConfiguration_800_480();
                //reboot |= LCDManager.SetLCDConfiguration_320_240();
                //reboot |= LCDManager.SetBootLogo(null, 0, 0);
                reboot |= LCDManager.SetLCDBootupMessages(true);

                if (reboot)
                {
                    Util.FlushExtendedWeakReferences();
                    PowerState.RebootDevice(false);
                }
            }

            GraphicsManager.Initialize();

            if (LCDManager.IsScreenAvailable)
            {
                if (!CalibrationManager.IsCalibrated)
                {
                    CalibrationWindow winCal = new CalibrationWindow();
                    winCal.Background = new LinearGradientBrush(Color.Blue, Color.Black);
                    winCal.CrosshairPen = new Pen(Color.LimeGreen, 1);

                    TextBlock text = new TextBlock(0, winCal.Height / 4, winCal.Width, 40, Resources.GetFont(Resources.FontResources.CourierNew_10), "Please tap the crosshairs to calibrate the screen");
                    text.ForeColor = Color.White;
                    text.TextAlignment = TextAlignment.Center;
                    text.TextVerticalAlignment = VerticalAlignment.Center;
                    text.TextWrap = true;
                    winCal.Children.Add(text);

                    winCal.ShowModal();
                }

                MainWindow wndMain = new MainWindow();
                wndMain.Show();

                // place your code here
            }
        }
Beispiel #10
0
        /// <summary>
        /// This method performs the calibration
        /// for the client, so that the
        /// system is ready for recording.
        /// </summary>
        /// <param name="isRecalibrating"><strong>True</strong> if calibration
        /// is in recalibration mode, indicating to renew only a few points,
        /// otherwise <strong>false</strong>.</param>
        /// <returns><strong>True</strong> if succesful calibrated,
        /// otherwise <strong>false</strong>.</returns>
        public bool Calibrate(bool isRecalibrating)
        {
            if (isRecalibrating)
            {
                this.calibrationWindow.Visibility = Visibility.Visible;
                this.calibrationWindow.Recalibrate();
            }
            else
            {
                // Save settings before starting calibration
                this.settingsWindow.SaveSettings();

                this.calibrationWindow         = new CalibrationWindow();
                this.calibrationWindow.Tracker = this.tracker;
                this.calibrationWindow.ExportCalibrationResults = true;
                this.calibrationWindow.Show();
                this.calibrationWindow.Start();
                this.calibrationWindow.CalibrationResultReadyEvent +=
                    new GazeTrackerUI.Calibration.Events.CalibrationResultEventHandler(this.CalibrationWindow_CalibrationResultReadyEvent);
            }

            return(true);
        }
Beispiel #11
0
		private void Calibrate()
		{
			var calibrationWindow = new CalibrationWindow();
			calibrationWindow.ShowDialog();
		}
Beispiel #12
0
        public MainWindowViewModel()
        {
            if (!InDesignMode.Check())
            {
                RTL.CallbackLog   += RTL_CallbackLog;
                RTL.CallbackError += RTL_CallbackError;

                Application.Current.MainWindow.Loaded += MainWindow_Loaded;
            }

            Сommand_UpdateCalibration = new RelayCommand((p) =>
            {
                CalibrationWindow ucw = new CalibrationWindow();

                ucw.Owner       = Application.Current.MainWindow;
                ucw.DataContext = this;
                ucw.ShowDialog();

                RTL.UpdateCalibrationRegion();
                RTL.CheckImages();
            }, (p) => (true));

            Сommand_WriteConfig = new RelayCommand((p) =>
            {
                if (p != null)
                {
                    switch ((string)p)
                    {
                    case "0":
                        byte[] data = RTL_FC.GetByteArray();
                        RTL.FlashWrite(RTL_FC.FlashAddr, (UInt32)data.Length, data);
                        break;

                    default:
                        break;
                    }
                }
            }, (p) => (RTL.IsInited));

            Сommand_ReadConfig = new RelayCommand((p) =>
            {
                if (p != null)
                {
                    switch ((string)p)
                    {
                    case "0":
                        byte[] data = new byte[RTL_FC.FlashSize];
                        if (RTL.FlashRead(RTL_FC.FlashAddr, RTL_FC.FlashSize, ref data))
                        {
                            RTL_FC.FromByteArray(data);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }, (p) => (RTL.IsInited));

            Сommand_EraseConfig = new RelayCommand((p) =>
            {
                if (p != null)
                {
                    switch ((string)p)
                    {
                    default:
                        break;
                    }
                }
            }, (p) => (RTL.IsInited));

            Сommand_Connect = new RelayCommand((p) =>
            {
                RTL.OpenDebugger();
                RTL.Connect();
            }, (p) => (!RTL.IsOpen));

            Сommand_Disconnect = new RelayCommand((p) =>
            {
                RTL.Disconnect();
            }, (p) => (RTL.IsConnected));

            Сommand_InitTargert = new RelayCommand((p) =>
            {
                RTL.InitTargert();
            }, (p) => (RTL.IsConnected));

            Сommand_RestartTargert = new RelayCommand((p) =>
            {
                RTL.Restart();
            }, (p) => (RTL.IsConnected));

            Сommand_EraseAll = new RelayCommand((p) =>
            {
                RTL.EraseAll();
            }, (p) => (RTL.IsConnected));

            Сommand_ReadIDRegs = new RelayCommand((p) =>
            {
                //RTL.ReadJedecID();
                RTL.ReadFlashID();
            }, (p) => (RTL.IsInited));

            Сommand_ReadFullFlash = new RelayCommand((p) =>
            {
                if (RTL.InitTargert())
                {
                    if (RTL.FlashRead())
                    {
                        RTL.CheckImages();
                        UpdateImagesPreview();
                    }
                }
            }, (p) => (RTL.IsConnected));

            Сommand_WriteFullFlash = new RelayCommand((p) =>
            {
                if (RTL.InitTargert())
                {
                    RTL.FlashWrite();
                }
            }, (p) => (RTL.IsConnected));

            Сommand_WriteParticleFlash = new RelayCommand((p) =>
            {
                if (RTL.InitTargert())
                {
                    ImagesSelectWindow isw = new ImagesSelectWindow();

                    isw.Owner       = Application.Current.MainWindow;
                    isw.DataContext = this;
                    isw.ShowDialog();

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.System) > 0) & RTL.Image1SPICIsOK)
                    {
                        RTL.FlashWrite(AmebaA_Addresses.SystemDataAddr, AmebaA_Addresses.SystemDataSize);
                    }

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.Calibration) > 0) & RTL.Image1CalibrationIsOK)
                    {
                        RTL.FlashWrite(AmebaA_Addresses.CalibrationDataAddr, AmebaA_Addresses.CalibrationDataSize);
                    }

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.Image1) > 0) & RTL.Image1IsSignatureOK)
                    {
                        RTL.FlashWrite(RTL.Image1FlashAddr, RTL.Image1SegSize);
                    }

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.Image2) > 0) & RTL.Image2IsSignatureOK)
                    {
                        RTL.FlashWrite(RTL.Image2FlashAddr, RTL.Image2SegSize);
                    }

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.Image3) > 0) & RTL.Image3IsSignatureOK)
                    {
                        RTL.FlashWrite(RTL.Image3FlashAddr, RTL.Image3SegSize);
                    }

                    if (((ImagesToWrite & (UInt16)AmebaA_ParticleImageBits.OTA) > 0) & RTL.ImageOTAIsSignatureOK)
                    {
                        RTL.FlashWrite(RTL.ImageOTAFlashAddr, RTL.ImageOTASegSize);
                    }
                }
            }, (p) => (RTL.IsConnected));

            Сommand_LoadFullFlash = new RelayCommand((p) =>
            {
                if (RTL.LoadFromFile())
                {
                    RTL.CheckImages();
                    UpdateImagesPreview();
                }
            }, (p) => (true));

            Сommand_ReloadFullFlash = new RelayCommand((p) =>
            {
                if (RTL.ReloadFromFile())
                {
                    RTL.CheckImages();
                    UpdateImagesPreview();
                }
            }, (p) => (!String.IsNullOrEmpty(RTL.LastFilePath)));

            Сommand_SaveFullFlash = new RelayCommand((p) =>
            {
                RTL.SaveToFile();
            }, (p) => (true));

            Сommand_ShowConfigurator = new RelayCommand((p) =>
            {
                if (RTL.InitTargert())
                {
                    ConfiguratorWindow cw = new ConfiguratorWindow();

                    cw.Owner       = Application.Current.MainWindow;
                    cw.DataContext = this;
                    cw.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error at Initializing SoC Flasher, check swd or jtag cable, speed settings, SoC reset...", "Error!");
                }
            }, (p) => (RTL.IsConnected));
        }
Beispiel #13
0
        private void ButtonCalibrate_Click(object sender, RoutedEventArgs e)
        {
            CalibrationWindow calibrationWindow = new CalibrationWindow(this.sensor);

            calibrationWindow.Show();
        }