Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            WindowState = WindowState.Maximized;

            // Assume the screen size won't change after the app starts.
            var xScreen = SystemParameters.PrimaryScreenWidth;
            var yScreen = SystemParameters.PrimaryScreenHeight;

            RobotArm = new RobotArm(
                xScreen / 2.0,
                yScreen / 2.0,
                Math.Min(xScreen, yScreen) / 2.0,
                Settings1.Default.RobotType == "Swift" ? ((IArm) new UArmSwiftPro()) : ((IArm) new UArmMetal()));

            _settings   = new Settings(RobotArm);
            DataContext = _settings;

            Background = new SolidColorBrush(_settings.BackgroundColor);

            if (_settings.RobotControl)
            {
                RobotArm.Connect();
                RobotArm.ArmDown(false); // Lift the arm.
            }

            SetDrawingAttributesFromSettings(inkCanvas.DefaultDrawingAttributes);

            LoadInkOnStartup();
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();

            WindowState = WindowState.Maximized;

            // Assume the screen size won't change after the app starts.
            var xScreen = SystemParameters.PrimaryScreenWidth;
            var yScreen = SystemParameters.PrimaryScreenHeight;

            RobotArm = new RobotArm(
                xScreen / 2.0,
                yScreen / 2.0,
                Math.Min(xScreen, yScreen) / 2.0,
                Settings1.Default.RobotType == "Swift" ? ((IArm) new UArmSwiftPro()) : ((IArm) new UArmMetal()));

            _settings   = new Settings(RobotArm);
            DataContext = _settings;

            Background = new SolidColorBrush(_settings.BackgroundColor);

            if (_settings.RobotControl)
            {
                RobotArm.Connect();
                RobotArm.ArmDown(false); // Lift the arm.
            }

            SetDrawingAttributesFromSettings(inkCanvas.DefaultDrawingAttributes);

            LoadInkOnStartup();

            this.SetDrawingZoneRectangle(0);                 // set the init drawing zone rectangle
            this.areaText.Visibility = Visibility.Collapsed; // init as collapsed
            this.Create_SaveFile_Directory();                // init the save file directory in the AppX folder
        }
        public SettingsWindow(
            MainWindow mainWindow,
            Settings settings,
            RobotArm robotArm)
        {
            _mainWindow = mainWindow;
            _settings   = settings;
            _robotArm   = robotArm;

            InitializeComponent();

            RobotControlCheckBox.IsChecked = _settings.RobotControl;

            // Explicitly disable the owning window here, to prevent any interaction
            // through eyegaze input while the Settings window is visible.
            Loaded   += (s, e) => Owner.IsEnabled = false;
            Unloaded += (s, e) =>
            {
                Owner.IsEnabled = true;
                mainWindow.Focus();
            };

            _windowIntialized = true;
        }
Exemple #4
0
        public Settings(RobotArm robotArm)
        {
            Arm = robotArm;

            LoadSettings();
        }