public Scenario1()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();

            run1.Text = ResourceManagerHelper.ReadValue("Description1_p1");
            Run run2 = new Run();

            run2.Text = ResourceManagerHelper.ReadValue("Description1_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            penSize = minPenSize + penSizeIncrement * selectThickness;
            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();

            drawingAttributes.Color          = Windows.UI.Colors.Red;
            drawingAttributes.Size           = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve     = true;
            //set drawingAttributes
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            this.SizeChanged += Scenario2_SizeChanged;
        }
        public Scenario3()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();

            run1.Text = ResourceManagerHelper.ReadValue("Description3_p1");
            Run run2 = new Run();

            run2.Text = ResourceManagerHelper.ReadValue("Description3_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            // By default, pen barrel button or right mouse button is processed for inking
            // Set the configuration to instead allow processing these input on the UI thread
            inkCanvas.InkPresenter.InputProcessingConfiguration.RightDragAction = InkInputRightDragAction.LeaveUnprocessed;

            inkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            inkCanvas.InkPresenter.UnprocessedInput.PointerPressed  += UnprocessedInput_PointerPressed;
            inkCanvas.InkPresenter.UnprocessedInput.PointerMoved    += UnprocessedInput_PointerMoved;
            inkCanvas.InkPresenter.UnprocessedInput.PointerReleased += UnprocessedInput_PointerReleased;

            // Handlers to clear the selection when inking or erasing is detected
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased             += InkPresenter_StrokesErased;

            SizeChanged += Scenario3_SizeChanged;
        }
Exemplo n.º 3
0
        public Scenario3_phone()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();

            run1.Text = ResourceManagerHelper.ReadValue("Description3_p1");
            Run run2 = new Run();

            run2.Text = ResourceManagerHelper.ReadValue("Description3_pp2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            // Handlers to clear the selection when inking or erasing is detected
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased             += InkPresenter_StrokesErased;

            SizeChanged += Scenario3_SizeChanged;
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            //load stroke
            base.OnNavigatedTo(e);
            int count = (int)e.Parameter;

            for (int i = 1; i <= count; i++)
            {
                ListStroke.Add(ResourceManagerHelper.ReadValue("selectStrokeText") + i.ToString());
            }
            this.StrokeControl.ItemsSource = ListStroke;
        }
        public Scenario2()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();

            run1.Text = ResourceManagerHelper.ReadValue("Description2_p1");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());

            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();

            drawingAttributes.Color = Windows.UI.Colors.Red;
            double penSize = 4;

            drawingAttributes.Size           = new Windows.Foundation.Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve     = true;

            // Show the available recognizers
            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            this.SizeChanged += Scenario2_SizeChanged;
        }
 public MainPage()
 {
     this.InitializeComponent();
     // This is a static public property that allows downstream pages to get a handle to the MainPage instance
     // in order to call methods that are in this class.
     Current          = this;
     SampleTitle.Text = ResourceManagerHelper.ReadValue("FeatureName");
     ListScenario     = new List <string>
     {
         ResourceManagerHelper.ReadValue("Scenario1"),
         ResourceManagerHelper.ReadValue("Scenario2"),
         ResourceManagerHelper.ReadValue("Scenario3"),
         ResourceManagerHelper.ReadValue("Scenario4")
     };
 }