Example #1
0
        private void ResetBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(BaseBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(BaseBox.Text);
                }
            }

            if (!string.IsNullOrEmpty(CompareBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(CompareBox.Text);
                }
            }

            BaseBox.SelectedText = "";
            CompareBox.Clear();
            DifferenceBox.Clear();
            HexBox.Clear();
            HexEscapedBox.Clear();
            ByteArrayBox.Clear();
            MaskBox.Clear();

            StatusLbl.Text      = "Awaiting input...";
            StatusLbl.ForeColor = BlueColor;
            FirstScan           = true;
        }
Example #2
0
 protected override void DoClosePopup(PopupCloseMode closeMode)
 {
     //Clear the filter textbox without
     //affecting the editor's EditValue
     MaskBox.SetEditValue("", "", true);
     base.DoClosePopup(closeMode);
 }
Example #3
0
 protected override void DoShowPopup()
 {
     //Clear the filter textbox without
     //affecting the editor's EditValue
     MaskBox.SetEditValue("", "", true);
     RunFilter(force: true);
     base.DoShowPopup();
 }
Example #4
0
        public AddLayerWindow()
        {
            InitializeComponent();
            _vm = new AddLayerViewModel();

            _vm.SelectFileCommand = new RelayCommand(o =>
            {
                var dialog = new Microsoft.Win32.OpenFileDialog()
                {
                    Title       = "Choose file",
                    Filter      = "Supported Images|*.svg;*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.tif",
                    Multiselect = false
                };

                var result = dialog.ShowDialog();

                if (result != null && result.Value)
                {
                    _vm.File = dialog.FileName;
                }
            });

            _vm.SelectMaskCommand = new RelayCommand(o =>
            {
                var dialog = new Microsoft.Win32.OpenFileDialog()
                {
                    Title       = "Choose mask",
                    Filter      = "Supported Images|*.svg;*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.tif",
                    Multiselect = false
                };

                var result = dialog.ShowDialog();

                if (result != null && result.Value)
                {
                    _vm.Mask = dialog.FileName;
                }
            });

            _vm.MaskRadioButtonCommand = new RelayCommand(o =>
            {
                var param = o.ToString();
                switch (param)
                {
                case "None":
                    MaskBox.IsEnabled    = false;
                    MaskButton.IsEnabled = false;
                    _vm.MaskType         = AddLayerViewModel.MaskTypes.None;
                    if (LayerType.SelectedItem != null)
                    {
                        _vm.UpdatePreview((Layer.LayerType)LayerType.SelectedItem);
                    }
                    break;

                case "User":
                    MaskBox.IsEnabled    = true;
                    MaskButton.IsEnabled = true;
                    _vm.MaskType         = AddLayerViewModel.MaskTypes.User;
                    if (LayerType.SelectedItem != null)
                    {
                        _vm.UpdatePreview((Layer.LayerType)LayerType.SelectedItem);
                    }
                    break;

                case "Auto":
                    MaskBox.IsEnabled    = false;
                    MaskButton.IsEnabled = false;
                    _vm.MaskType         = AddLayerViewModel.MaskTypes.Autogenerated;
                    if (LayerType.SelectedItem != null)
                    {
                        _vm.UpdatePreview((Layer.LayerType)LayerType.SelectedItem);
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            });

            DataContext = _vm;
            _vm.MaskRadioButtonCommand.Execute("None");

            // Need to add these handlers manually since the TextBox already has handlers for some kinds of drag-and-drop data types.
            // https://msdn.microsoft.com/en-us/library/hh144798(v=vs.110).aspx
            FileBox.AddHandler(TextBox.DropEvent, new DragEventHandler(LayerFileBox_OnDrop), true);
            MaskBox.AddHandler(TextBox.DropEvent, new DragEventHandler(LayerMaskBox_OnDrop), true);
        }