/// <summary>
        /// Load the selected image main panel for further opertaion.
        /// </summary>
        /// <param name="model">Details of the image from the AI result to be loaded</param>
        private void ImageSelectedExecute(ImageSearchModel model)
        {
            SnipInsightViewModel viewModel = AppManager.TheBoss.ViewModel;
            var aiPanelVM = ServiceLocator.Current.GetInstance <AIPanelViewModel>();

            AppManager.TheBoss.OnSaveImage();

            if (string.IsNullOrEmpty(viewModel.RestoreImageUrl))
            {
                viewModel.RestoreImageUrl = viewModel.SavedCaptureImage;
            }

            ImageLoader.LoadFromUrl(new Uri(model.URL)).ContinueWith(t =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    aiPanelVM.CapturedImage    = t.Result;
                    viewModel.SelectedImageUrl = model.URL;
                    AppManager.TheBoss.RunAllInsights();
                });
            }, TaskContinuationOptions.OnlyOnRanToCompletion);

            ImageLoader.LoadFromUrl(new Uri(model.URL)).ContinueWith(t =>
            {
                MessageBox.Show(Resources.Image_Not_Loaded);
            }, TaskContinuationOptions.NotOnRanToCompletion);
        }
Exemplo n.º 2
0
        private void InkCanvasOnStrokeErased(object sender, RoutedEventArgs routedEventArgs)
        {
            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model != null)
            {
                model.HasInk = HasInk();
            }
        }
Exemplo n.º 3
0
        private void InkCanvasOnStrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs inkCanvasStrokeCollectedEventArgs)
        {
            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model != null)
            {
                model.HasInk = true;
            }
        }
Exemplo n.º 4
0
        private void PenButton_Check(object sender, RoutedEventArgs e)
        {
            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model == null)
            {
                return;
            }

            SetInkColor(lastCheckedInkButton);

            AppManager.TheBoss.ResetEditorButtons(AppManager.EditorTools.Pen);
        }
        private void PenSizeButton_Click(object sender, RoutedEventArgs e)
        {
            int ptSize = 3;

            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model == null)
            {
                return;
            }

            if (sender == PenSize1Button)
            {
                Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.PenSize1Button, Telemetry.ViewName.EditorSideNavigation);
                ptSize = 1;
            }
            else if (sender == PenSize3Button)
            {
                Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.PenSize3Button, Telemetry.ViewName.EditorSideNavigation);
                ptSize = 3;
            }
            else if (sender == PenSize5Button)
            {
                Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.PenSize5Button, Telemetry.ViewName.EditorSideNavigation);
                ptSize = 5;
            }
            else if (sender == PenSize9Button)
            {
                Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.PenSize9Button, Telemetry.ViewName.EditorSideNavigation);
                ptSize = 9;
            }

            if (ptSize != 0)
            {
                model.InkDrawingAttributes.Width         = ptSize;
                model.InkDrawingAttributes.Height        = ptSize;
                model.InkDrawingAttributes.IsHighlighter = false;
                model.InkDrawingAttributes.StylusTip     = System.Windows.Ink.StylusTip.Ellipse;
                model.InkModeRequested = InkCanvasEditingMode.Ink;
                lastCheckedPenSize     = ptSize;

                HighlightPenSize(ptSize);

                //var currentInkButton = LeftBar.Children.OfType<AriInkRadioButton>().FirstOrDefault(t => t.IsChecked.HasValue && t.IsChecked.Value);
                //if (currentInkButton == null)
                //{
                //    lastCheckedInkButton.IsChecked = true;
                //}
            }
        }
Exemplo n.º 6
0
        void OnLoaded(object sender, RoutedEventArgs e)
        {
            _animateAnts = (Storyboard)this.TryFindResource("animateAnts");
            if (_animateAnts != null)
            {
                _animateAnts.Begin();
                _animateAnts.Pause();
            }

            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model != null)
            {
                model.PropertyChanged += ViewModelOnPropertyChanged;
            }
        }
        private void Highlighter_Checked(object sender, RoutedEventArgs e)
        {
            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model == null)
            {
                return;
            }

            model.InkDrawingAttributes.Width         = 6;
            model.InkDrawingAttributes.Height        = 20;
            model.InkDrawingAttributes.IsHighlighter = true;
            model.InkDrawingAttributes.Color         = highlighterColors[0];
            model.InkDrawingAttributes.StylusTip     = System.Windows.Ink.StylusTip.Rectangle;
            model.InkModeRequested = InkCanvasEditingMode.Ink;

            AppManager.TheBoss.ResetEditorButtons(AppManager.EditorTools.Highlighter);
        }
Exemplo n.º 8
0
        private void PenButton_Click(object sender, RoutedEventArgs e)
        {
            SnipInsightViewModel model = DataContext as SnipInsightViewModel;

            if (model == null)
            {
                return;
            }

            if (model.penSelected)
            {
                PenPalettePopup.IsOpen = true;
            }
            else
            {
                model.penSelected = true;
                SetInkColor(lastCheckedInkButton);
            }
        }
Exemplo n.º 9
0
        void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                SnipInsightViewModel model = DataContext as SnipInsightViewModel;
                if (model == null)
                {
                    return;
                }

                switch (e.PropertyName)
                {
                case "Mode":
                {
                    if (_animateAnts != null)
                    {
                        switch (model.Mode)
                        {
                        case Mode.Recording:
                            _animateAnts.Resume();
                            break;

                        default:
                            _animateAnts.Pause();
                            break;
                        }
                    }
                }
                break;

                case "InkModeRequested":
                    InkCanvas.EditingMode = model.InkModeRequested;
                    break;
                }
            }
            catch (Exception ex)
            {
                Diagnostics.ReportException(ex);
            }
        }