예제 #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();

            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
        }
예제 #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();
        }
예제 #3
0
        private void RobotControlCheckBox_CheckedStateChanged(object sender, RoutedEventArgs e)
        {
            if (!_windowIntialized)
            {
                return;
            }

            _settings.RobotControl = RobotControlCheckBox.IsChecked.Value;

            if (_settings.RobotControl)
            {
                _robotArm.Connect();
            }
            else
            {
                _robotArm.Disconnect(); // must disconnect *before* disabling
            }

            Settings1.Default.RobotControl = _settings.RobotControl;
            Settings1.Default.Save();
        }