示例#1
0
        /// <summary>
        /// Initialize the app.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();

            // Set application window to full screen & get its dimensions.
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            var    bounds    = Window.Current.Bounds;
            double appHeight = bounds.Height;
            double appWidth  = bounds.Width;

            // instantiate Robot Arm & settings
            RobotArm = new RobotArm(
                appWidth / 2.0,
                appHeight / 2.0,
                Math.Min(appWidth, appHeight) / 2.0,
                new UArmSwiftPro());

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

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

            // set the default drawing attributes
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();

            SetDrawingAttributesFromSettings(drawingAttributes);
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);

            inkCanvas.InkPresenter.InputDeviceTypes =
                CoreInputDeviceTypes.Mouse |
                CoreInputDeviceTypes.Pen |
                CoreInputDeviceTypes.Touch;

            LoadInkOnStartup();
        }
示例#2
0
        public Settings(RobotArm robotArm)
        {
            Arm = robotArm;

            LoadSettings();
        }