Ejemplo n.º 1
0
        public TimelapseWindow()
        {
            InitializeComponent();
            //CheckForUpdate.GetAndParseVersion (this, false);

            ResetDifferenceThreshold();
            this.markableCanvas = new MarkableImageCanvas();
            this.markableCanvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            this.markableCanvas.PreviewMouseDown +=new MouseButtonEventHandler(markableCanvas_PreviewMouseDown);
            this.markableCanvas.MouseEnter += new MouseEventHandler(markableCanvas_MouseEnter);
            markableCanvas.RaiseMetaTagEvent += new EventHandler<MetaTagEventArgs>(markableCanvas_RaiseMetaTagEvent);
            this.mainUI.Children.Add(markableCanvas);

            // Callbacks so the controls will highlight if they are copyable when one enters the btnCopy button
            this.btnCopy.MouseEnter += btnCopy_MouseEnter;
            this.btnCopy.MouseLeave += btnCopy_MouseLeave;

            // Create data controls, including reparenting the copy button from the main window into the my control window.
            myControls = new Controls(this.dbData);
            this.ControlGrid.Children.Remove(this.btnCopy);
            myControls.AddButton(this.btnCopy);

            // Recall states from prior sessions
            this.state.audioFeedback = persist.ReadAudioFeedback();
            this.state.controlWindowSize = persist.ReadControlWindowSize();
            this.MenuItemAudioFeedback.IsChecked = this.state.audioFeedback;
            this.MenuItemControlsInSeparateWindow.IsChecked = persist.ReadControlWindow();
            this.darkPixelThreshold = persist.ReadDarkPixelThreshold();
            this.darkPixelRatioThreshold = persist.ReadDarkPixelRatioThreshold();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mycontrols"></param>
        /// <param name="createContextMenu"></param>
        public MyFlag(Controls mycontrols, bool createContextMenu)
            : base(mycontrols, createContextMenu)
        {
            // Create the label (which is an actual label)
            this.LabelCtl = new Label();
            LabelCtl.Style = mycontrols.FindResource("LabelCodeBar") as Style;
            this.LabelCtl.IsTabStop = false;

            // Create the content box (which is a text box)
            this.ContentCtl = new CheckBox();
            Style style2 = mycontrols.FindResource("FlagCodeBar") as Style;
            this.ContentCtl.Style = style2;
            this.ContentCtl.IsTabStop = true;

            // Add the label and content controls to the stack panel (which will have been created before this in the super class)
            m_panel.Children.Add(LabelCtl);
            m_panel.Children.Add(ContentCtl);

            // Now configure the various elements
            this.m_panel.ToolTip = "Toggle between true (checked) and false (unchecked)";

            // Change the menu text to indicate that propagate goes back to the last non-zero value
            miPropagateFromLastValue.Header = "Propagate from the last non-zero value to here";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mycontrols"></param>
        /// <param name="createContextMenu"></param>
        public MyNote(Controls mycontrols, bool createContextMenu)
            : base(mycontrols, createContextMenu)
        {
            // Create the label (which is an actual label)
            this.LabelCtl = new Label();
            LabelCtl.Style = mycontrols.FindResource("LabelCodeBar") as Style;
            this.LabelCtl.IsTabStop = false;

            // Create the content box (which is a text box)
            this.ContentCtl = new TextBox();

            // Modify the context menu so it can have a propage submenu
            this.ContentCtl.ContextMenu = null;

            Style style2 = mycontrols.FindResource("TextBoxCodeBar") as Style;
            this.ContentCtl.Style = style2;
            this.ContentCtl.IsTabStop = true;

            // Add the label and content controls to the stack panel (which will have been created before this in the super class)
            m_panel.Children.Add(LabelCtl);
            m_panel.Children.Add(ContentCtl);

            // Now configure the various elements
            this.m_panel.ToolTip = "Type in text";
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mycontrols"></param>
        /// <param name="createContextMenu"></param>
        /// <param name="list"></param>
        public MyFixedChoice(Controls mycontrols, bool createContextMenu, string list)
            : base(mycontrols, createContextMenu)
        {
            // Create the label (which is an actual label)
            this.LabelCtl = new Label();
            LabelCtl.Style = mycontrols.FindResource("LabelCodeBar") as Style;
            this.LabelCtl.IsTabStop = false;

            // Create the content box (which is a text box)
            this.ContentCtl = new ComboBox();
            //Style style2 = mycontrols.FindResource("ComboBoxCodeBar") as Style;
            //this.ContentCtl.Style = style2;

            // The look of the combobox
            this.ContentCtl.Height = 25;
            this.ContentCtl.HorizontalAlignment = HorizontalAlignment.Left;
            this.ContentCtl.VerticalAlignment = VerticalAlignment.Center;
            this.ContentCtl.VerticalContentAlignment = VerticalAlignment.Center;
            this.ContentCtl.BorderThickness = new Thickness(1);
            this.ContentCtl.BorderBrush = Brushes.LightBlue;

            // The behaviour of the combobox
            this.ContentCtl.IsTabStop = true;
            this.ContentCtl.IsTextSearchEnabled = true;
            this.ContentCtl.Focusable=true;
            this.ContentCtl.IsReadOnly = true;
            this.ContentCtl.IsEditable = false;

            // Callback used to allow Enter to select the highlit item
            this.ContentCtl.PreviewKeyDown += ContentCtl_PreviewKeyDown;

            // Add items to the combo box
            List<string> result = list.Split(new char[] { '|' }).ToList();
            foreach (string str in result)
            {
                this.ContentCtl.Items.Add(str.Trim());
            }
            // Add a separator and an empty field to the list, so the user can return it to an empty state. Note that this means ImageQuality can also be empty.. not sure if this is a good thing
            this.ContentCtl.Items.Add(new Separator());
            this.ContentCtl.Items.Add("");

            this.ContentCtl.SelectedIndex = 0;

            // Add the label and content controls to the stack panel (which will have been created before this in the super class)
            m_panel.Children.Add(LabelCtl);
            m_panel.Children.Add(ContentCtl);

            // Now configure the various elements
            this.m_panel.ToolTip = "Type in text";
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mycontrols"></param>
        /// <param name="createContextMenu"></param>
        public MyCounter(Controls mycontrols, bool createContextMenu)
            : base(mycontrols, createContextMenu)
        {
            // Create and configure the label (which is a radio button)
            this.LabelCtl = new RadioButton();
            LabelCtl.Style = mycontrols.FindResource("RadioButtonCodeBar") as Style;
            this.LabelCtl.IsTabStop = false;

            // Create the content box (which is a text box)
            this.ContentCtl = new TextBox();
            Style style2 = mycontrols.FindResource("TextBoxCodeBar") as Style;
            this.ContentCtl.Style = style2;
            this.ContentCtl.IsTabStop = true;

            // Modify the context menu so it can have a propage submenu
            this.ContentCtl.ContextMenu = null;

            // Add the label and content controls to the stack panel (which will have been created before this in the super class)
            m_panel.Children.Add(LabelCtl);
            m_panel.Children.Add(ContentCtl);

            // Now configure the various elements
            this.m_panel.ToolTip = "Select the button, then click on the entity in the image to increment its count OR type in a number";

            // Make this part of a group with all the other radio buttons of this type
            this.LabelCtl.GroupName = "A";

            // Add this counter to the list of counters, so we can quickly access all counters
            this.mycontrols.MyCountersList.Add(this);

            // Change the menu text to indicate that propagate goes back to the last non-zero value
            miPropagateFromLastValue.Header = "Propagate from the last non-zero value to here";
        }
Ejemplo n.º 6
0
        protected string m_dataLabel = ""; // The dataLabel used as the column header in the spreadsheet

        #endregion Fields

        #region Constructors

        public MyControl(Controls mycontrols, bool createContextMenu)
        {
            // Set these parameters so they are available in the derived objects
            this.mycontrols = mycontrols;
            this.Container = new StackPanel();

            // Create the stack panel and add the label and textbox to it
            Style style = mycontrols.FindResource("StackPanelCodeBar") as Style;
            this.Container.Style = style;

            // Create the context menu
            this.createContextMenu = createContextMenu;

            if (createContextMenu)  // Create the context menu
            {
                //MenuItem miPropagateFromLastValue = new MenuItem();
                miPropagateFromLastValue.IsCheckable = false;
                miPropagateFromLastValue.Header = "Propagate from the last non-empty value to here";
                miPropagateFromLastValue.Click += new RoutedEventHandler(miPropagateFromLastValue_Click);

                //MenuItem miCopyForward = new MenuItem();
                miCopyForward.IsCheckable = false;
                miCopyForward.Header = "Copy forward to end";
                miCopyForward.ToolTip = "The value of this field will be copied forward from this image to the last image in this set";
                miCopyForward.Click += new RoutedEventHandler(miPropagateForward_Click);

                //MenuItem miCopyCurrentValue = new MenuItem();
                miCopyCurrentValue.IsCheckable = false;
                miCopyCurrentValue.Header = "Copy to all";
                miCopyCurrentValue.Click += new RoutedEventHandler(miCopyCurrentValue_Click);

                menu.Items.Add(miPropagateFromLastValue);
                menu.Items.Add(miCopyForward);
                menu.Items.Add(miCopyCurrentValue);

                // This doesn't work, i.e., adding the cut/copy/paste submenu, although it appears.
                // Probably because I have to implement my own handlers
                //MenuItem micut = new MenuItem();
                //micut.Command = ApplicationCommands.Cut;
                //menu.Items.Add(micut);

                //menu.Items.Add(new Separator());
                //MenuItem micopy = new MenuItem();
                //micopy.Command = ApplicationCommands.Copy;
                //menu.Items.Add(micopy);

                //MenuItem mipaste = new MenuItem();
                //mipaste.Command = ApplicationCommands.Paste;
                //menu.Items.Add(mipaste);

                this.Container.PreviewMouseRightButtonDown += Container_PreviewMouseRightButtonDown;
                this.Container.ContextMenu = menu;
            }
        }
Ejemplo n.º 7
0
 /// <summary> Remove the myControl user control from this window  </summary>
 /// <param name="myControls"></param>
 public void ChildRemove(Controls myControls)
 {
     this.TopLevelGrid.Children.Remove(myControls);
 }
Ejemplo n.º 8
0
 /// <summary> Add the myControl user control to this window  </summary>
 /// <param name="myControls"></param>
 public void AddControls(Controls myControls)
 {
     this.TopLevelGrid.Children.Add (myControls);
 }