Exemple #1
0
        protected override void AddDynamicControls()
        {
            NotesContainer.Children.Add(CloneTextBox);
            NotesContainer.Children.Add(DisableBorder);

            CloneTextBox.Focus();
        }
                /// <summary>
                ///
                /// </summary>
                public SpecialCommandsGroup(ViewerStateModel vsm, Point location, Size size, int tabIndex)
                {
                    this.SuspendLayout();

                    this.FlatStyle = FlatStyle.System;
                    this.Location  = location;
                    this.Size      = size;
                    this.TabIndex  = tabIndex;
                    this.Name      = "SpecialCommandsGroup";
                    this.TabStop   = false;
                    this.Text      = Strings.CustomCommands;
                    this.Enabled   = true;

                    // Add the controls
                    this.Controls.Add(new DeviceInfoLabel(new Point(16, 17), new Size(100, 24), 7));
                    deviceDropDown = new DeviceDropDown(vsm, new Point(118, 16), new Size(308, 21), 8);
                    this.Controls.Add(deviceDropDown);
                    this.Controls.Add(new CloneInfoLabel(new Point(30, 41), new Size(148, 24), 9));
                    cloneTextBox = new CloneTextBox(vsm, new Point(180, 40), new Size(246, 21), 10);
                    this.Controls.Add(cloneTextBox);
                    this.Controls.Add(new ExtendedInfoLabel(new Point(30, 65), new Size(138, 24), 11));
                    extendedTextBox = new ExtendedTextBox(vsm, new Point(180, 64), new Size(246, 21), 12);
                    this.Controls.Add(extendedTextBox);

                    this.ResumeLayout();
                }
Exemple #3
0
        protected override void CloneTextBox_LostFocus(object sender, EventArgs e)
        {
            base.CloneTextBox_LostFocus(sender, e);
            var mouseEventArgs = e as MouseEventExtArgs;

            if (!IsValid)
            {
                if (mouseEventArgs != null)
                {
                    mouseEventArgs.Handled = true;
                }
                return;
            }
            if (e != null && mouseEventArgs == null)
            {
                return;
            }
            if (e != null)
            {
                System.Windows.Point absolutePoint =
                    CloneTextBox.PointToScreen(new System.Windows.Point(0d, 0d));
                var absoluteRectangle = new Rectangle((int)absolutePoint.X, (int)absolutePoint.Y, CloneTextBoxLocation.Width, CloneTextBoxLocation.Height);
                if (absoluteRectangle.Contains(mouseEventArgs.X, mouseEventArgs.Y))
                {
                    return;
                }
            }
            if (CloneTextBox.Tag.ToString() != CloneTextBox.Text)
            {
                if (!ChangedFileName)
                {
                    RenameProject(CloneTextBox.Tag.ToString(), CloneTextBox.Text);
                }
                else
                {
                    LoadedFile file = null;
                    foreach (var proj in Notes)
                    {
                        foreach (var f in proj.Value.Files)
                        {
                            if (f.Path == CloneTextBox.Tag.ToString())
                            {
                                file = f;
                                break;
                            }
                        }
                    }
                    if (file == null)
                    {
                        return;
                    }
                    string directoryPath = Path.GetDirectoryName(file.Path) + "\\";
                    RenameFileInProject(Directory.GetParent(directoryPath).Parent.Name, file, CloneTextBox.Text);
                    IsChangeFileName = false;
                }
            }
            // MainProjectList.Items.Refresh();
            EndChangingDynamicItem();
        }
 protected override void AddDynamicControls()
 {
     BrowseContainer.Children.Add(CloneTextBox);
     CloneTextBox.Focus();
     BrowseContainer.PreviewMouseDown -= CloneTextBox_LostFocus;
     BrowseContainer.PreviewMouseDown += CloneTextBox_LostFocus;
     MainProjectList.IsEnabled         = false;
 }
Exemple #5
0
 protected void EndChangingDynamicItem()
 {
     Validation.ClearInvalid(CloneTextBox.GetBindingExpression(TextBox.TextProperty));
     if (ErrorToolTip != null)
     {
         ErrorToolTip.IsOpen = false;
         ErrorToolTip        = null;
     }
     Binding = null;
     RemoveDynamicControls();
     DisposeDynamicItems();
 }
Exemple #6
0
        private void InitializeBinding()
        {
            Binding binding = new Binding();

            binding.Source = this;
            binding.Path   = new PropertyPath("BindingPath");
            binding.Mode   = BindingMode.OneWayToSource;
            binding.UpdateSourceTrigger     = UpdateSourceTrigger.PropertyChanged;
            binding.ValidatesOnDataErrors   = true;
            binding.NotifyOnValidationError = true;
            CloneTextBox.SetBinding(TextBox.TextProperty, binding);
        }
Exemple #7
0
 protected virtual void OnValidate()
 {
     if (Binding == null)
     {
         Binding = CloneTextBox.GetBindingExpression(TextBox.TextProperty);
     }
     IsValid = IsValidName();
     if (!IsValid)
     {
         Validation.MarkInvalid(Binding, new ValidationError(new ExceptionValidationRule(), Binding));
         if (ErrorToolTip == null)
         {
             ErrorToolTip = new ToolTip {
                 Content = TextRedactor.PathErrorMessage
             };
             CloneTextBox.ToolTip = ErrorToolTip;
         }
         ErrorToolTip.IsOpen = true;
     }
 }
Exemple #8
0
 protected override void OnValidate()
 {
     if (!Notes.ContainsKey(CloneTextBox.Tag.ToString()) || Notes.ContainsKey(CloneTextBox.Text) || !File.Exists(ParentControl.BrowseProject.LoadedFile))
     {
         IsValid = false;
         if (Binding == null)
         {
             Binding = CloneTextBox.GetBindingExpression(TextBox.TextProperty);
         }
         Validation.MarkInvalid(Binding, new ValidationError(new ExceptionValidationRule(), Binding));
         if (ErrorToolTip == null)
         {
             ErrorToolTip = new ToolTip {
                 Content = TextRedactor.PathErrorMessage
             };
             CloneTextBox.ToolTip = ErrorToolTip;
         }
         ErrorToolTip.IsOpen = true;
     }
     else
     {
         IsValid = true;
     }
 }
Exemple #9
0
        protected override void CloneTextBox_LostFocus(object sender, EventArgs e)
        {
            base.CloneTextBox_LostFocus(sender, e);
            if (!IsValid)
            {
                return;
            }
            var mouseEventArgs = e as MouseEventExtArgs;

            if (e != null && mouseEventArgs == null)
            {
                return;
            }
            if (e != null)
            {
                System.Windows.Point absolutePoint =
                    CloneTextBox.PointToScreen(new System.Windows.Point(0d, 0d));
                var absoluteRectangle = new Rectangle((int)absolutePoint.X, (int)absolutePoint.Y, CloneTextBoxLocation.Width, CloneTextBoxLocation.Height);
                if (absoluteRectangle.Contains(mouseEventArgs.X, mouseEventArgs.Y))
                {
                    return;
                }
            }
            if (CloneTextBox.Tag.ToString() != CloneTextBox.Text)
            {
                string name = CloneTextBox.Tag.ToString();
                //File.Move(file, Path.GetDirectoryName(file) + "\\" + CloneTextBox.Text + Path.GetExtension(file));
                Notes.Add(CloneTextBox.Text, Notes[name]);
                Notes[CloneTextBox.Text].Name = CloneTextBox.Text;
                updageTagOnFlag(Notes[CloneTextBox.Text]);
                Notes.Remove(name);
                OnSave(() => { }, ParentControl.BrowseProject.LoadedFile);
            }
            MainControl.Items.Refresh();
            EndChangingDynamicItem();
        }
                /// <summary>
                ///
                /// </summary>
                public SpecialCommandsGroup( ViewerStateModel vsm, Point location, Size size, int tabIndex )
                {
                    this.SuspendLayout();

                    this.FlatStyle = FlatStyle.System;
                    this.Location = location;
                    this.Size = size;
                    this.TabIndex = tabIndex;
                    this.Name = "SpecialCommandsGroup";
                    this.TabStop = false;
                    this.Text = Strings.CustomCommands;
                    this.Enabled = true;

                    // Add the controls
                    this.Controls.Add( new DeviceInfoLabel( new Point( 16, 17 ), new Size( 100, 24 ), 7 ) );
                    deviceDropDown = new DeviceDropDown( vsm, new Point( 118, 16 ), new Size( 308, 21 ), 8 );
                    this.Controls.Add( deviceDropDown );
                    this.Controls.Add( new CloneInfoLabel( new Point( 30, 41 ), new Size( 148, 24 ), 9 ) );
                    cloneTextBox = new CloneTextBox( vsm, new Point( 180, 40 ), new Size( 246, 21 ), 10 );
                    this.Controls.Add( cloneTextBox );
                    this.Controls.Add( new ExtendedInfoLabel( new Point( 30, 65 ), new Size( 138, 24 ), 11 ) );
                    extendedTextBox = new ExtendedTextBox( vsm, new Point( 180, 64 ), new Size( 246, 21 ), 12 );
                    this.Controls.Add( extendedTextBox );

                    this.ResumeLayout();
                }