private void UpdateImage()
        {
            Texture2D t = CreateTextureFromImageGestureImage(LastImage);

            Image.texture = t;

            if (MatchedImage == null)
            {
                MatchLabel.text = "No match";

                // no match add a script entry
                if (ScriptText != null)
                {
                    ScriptText.text += LastImage.GetCodeForRowsInitialize(ImageNameText == null ? null : ImageNameText.text) +
                                       "," + System.Environment.NewLine;

                    if (AutoAddImages && ImageNameText != null && ImageNameText.text.Length != 0)
                    {
                        ImageGesture.GestureImages.Add(LastImage);
                        RecognizableImages[LastImage] = ImageNameText.text;
                    }
                }
            }
            else
            {
                MatchLabel.text = "Match: " + RecognizableImages[MatchedImage];
            }

            MatchLabel.text += " (" + ImageGesture.MatchedGestureCalculationTimeMilliseconds + " ms)";

            ImageGesture.Reset();
        }
        public void CopyScriptToClipboard()
        {
#if UNITY_EDITOR
            if (LastImage == null)
            {
                Debug.LogError("No image created yet");
            }
            else
            {
                TextEditor te = new TextEditor();
                te.text = LastImage.GetCodeForRowsInitialize();
                te.SelectAll();
                te.Copy();
            }
#endif
        }
Beispiel #3
0
        /// <summary>
        /// Update the toolbar button
        /// </summary>
        private void UpdateToolBarButton()
        {
            if (_report != null)
            {
                TBBRefresh.EnableButton();
                TBBPrint.EnableButton();
                ExportDefault.EnableButton();
                ExportMenu.IsEnabled = true;
                ExportMenu.Opacity   = 1;
                TBBPrintWithProperties.EnableButton();
                ZoomInfoStackPanel.Visibility = Visibility.Visible;
                ZoomPopupButton.Visibility    = Visibility.Visible;
                ZoomPopupButton.IsEnabled     = true;
                ZoomPopupButton.Opacity       = 1;
            }
            else
            {
                TBBRefresh.DisableButton();
                TBBPrint.DisableButton();
                ExportDefault.DisableButton();
                ExportMenu.IsEnabled = true;
                ExportMenu.Opacity   = 1;
                TBBPrintWithProperties.DisableButton();
                ZoomInfoStackPanel.Visibility = Visibility.Collapsed;
                ZoomPopupButton.Visibility    = Visibility.Collapsed;
                ZoomPopupButton.IsEnabled     = false;
                ZoomPopupButton.Opacity       = 0.5;
            }


            if (_pos == 0)
            {
                PagerSeparator.Visibility = Visibility.Visible;
                PreviousImage.DisableButton();
                FirstImage.DisableButton();
                NextImage.EnableButton();
                LastImage.EnableButton();
            }
            else
            {
                if (_pos + 1 == this._report.PagesCount)
                {
                    NextImage.DisableButton();
                    LastImage.DisableButton();
                    PreviousImage.EnableButton();
                    FirstImage.EnableButton();
                }
                else
                {
                    PreviousImage.EnableButton();
                    NextImage.EnableButton();
                    FirstImage.EnableButton();
                    LastImage.EnableButton();
                }
            }

            if (this._report.PagesCount > 1)
            {
                PagerSeparator.Visibility = Visibility.Visible;
                PreviousImage.Visibility  = Visibility.Visible;
                NextImage.Visibility      = Visibility.Visible;
                FirstImage.Visibility     = Visibility.Visible;
                LastImage.Visibility      = Visibility.Visible;
                PageSpinner.Visibility    = Visibility.Visible;
            }
            else
            {
                PagerSeparator.Visibility = Visibility.Collapsed;
                PreviousImage.Visibility  = Visibility.Collapsed;
                NextImage.Visibility      = Visibility.Collapsed;
                FirstImage.Visibility     = Visibility.Collapsed;
                LastImage.Visibility      = Visibility.Collapsed;
                PageSpinner.Visibility    = Visibility.Collapsed;
            }
        }