Esempio n. 1
0
        private void MergeFile(WindowControl fileDialog, string path)
        {
            var buttonOpen = new NativeButton(fileDialog.IdentifyFromWindowText("開く(&O)"));

            var comboBoxMergeOrderSrc = fileDialog.GetFromWindowClass("ComboBox").OrderBy(e =>
            {
                RECT rc;
                GetWindowRect(e.Handle, out rc);
                return(rc.Top);
            }).Last();
            var comboBoxMergeOrder = new NativeComboBox(comboBoxMergeOrderSrc);

            comboBoxMergeOrder.EmulateSelectItem(1);


            var editPathSrc = fileDialog.GetFromWindowClass("Edit").OrderBy(e =>
            {
                RECT rc;
                GetWindowRect(e.Handle, out rc);
                return(rc.Left);
            }).Last();
            var editPath = new NativeEdit(editPathSrc);

            editPath.EmulateChangeText(path);

            buttonOpen.EmulateClick();
        }
        public OpenFileDialogDriver(WindowControl window)
        {
            _window = window;
            var combo = _window.GetFromWindowClass("ComboBoxEx32").OrderBy(e => NativeMethods.GetTop(e)).Last();

            ComboBox_FilePath = new NativeComboBox(combo);
            Button_開く         = new NativeButton(_window.IdentifyFromWindowText("開く(&O)"));
            Button_キャンセル      = new NativeButton(_window.IdentifyFromWindowText("キャンセル"));
        }
        public SaveFileDialogDriver(WindowControl window)
        {
            _window = window;
            var combo = _window.GetFromWindowClass("ComboBox").OrderBy(e => NativeMethods.GetTop(e)).ToArray()[1];

            ComboBox_FilePath = new NativeComboBox(combo);
            Button_保存         = new NativeButton(_window.IdentifyFromWindowText("保存(&S)"));
            Button_キャンセル      = new NativeButton(_window.IdentifyFromWindowText("キャンセル"));
        }
        public OpenFileDialogDriver(WindowControl window)
        {
            Core = window;
            ComboBox_FilePath = new NativeComboBox(Core.GetFromWindowClass("ComboBoxEx32").OrderBy(e => GetWindowRect(e.Handle).Top).Last());
            var handle = ComboBox_FilePath.ParentWindow.Handle;

            try
            {
                ComboBox_FileType = new NativeComboBox(Core.GetFromWindowClass("ComboBox").Where(e => e.ParentWindow.Handle == handle).OrderBy(e => GetWindowRect(e.Handle).Top).Last());
            }
            catch { }
            Button_Open   = new NativeButton(Core.IdentifyFromWindowText("開く(&O)"));
            Button_Cancel = new NativeButton(Core.IdentifyFromWindowText("キャンセル"));
        }
Esempio n. 5
0
        public SaveFileDialogDriver(WindowControl core)
        {
            Core = core;

            var combos        = Core.GetFromWindowClass("ComboBox");
            int indexFileName = combos.Length == 3 ? 1 : 0;
            int indexFileType = combos.Length == 3 ? 2 : 1;
            var sortedComobs  = combos.OrderBy(e => GetWindowRect(e.Handle).Top).ToArray();

            ComboBox_FileName = new NativeComboBox(sortedComobs[indexFileName]);
            ComboBox_FileType = new NativeComboBox(sortedComobs[indexFileType]);

            Button_Save   = new NativeButton(Core.IdentifyFromWindowText("保存(&S)"));
            Button_Cancel = new NativeButton(Core.IdentifyFromWindowText("キャンセル"));
        }
Esempio n. 6
0
        internal override FrameworkElement GenerateEditingElement(object childData)
        {
            Binding b = Binding as Binding;

            if (b.Mode == BindingMode.OneWay)
            {
                if (!b.INTERNAL_WasModeSetByUserRatherThanDefaultValue())
                {
                    b.Mode = BindingMode.TwoWay;
                }
            }
            object value = PropertyPathHelper.AccessValueByApplyingPropertyPathIfAny(childData, b.Path.Path);

            if (!(value is Enum))
            {
                throw new NotImplementedException("DataGridComboBoxColumns currently only works with Enum types");
            }
            Type           enumType   = value.GetType();
            var            enumValues = Enum.GetValues(enumType);//  enumType.GetEnumValues();
            NativeComboBox cb         = new NativeComboBox();

            cb.DataContext = childData;
            if (enumValues != null && enumValues.Length > 0)
            {
#if BRIDGE
                //Note: work around the fact that Enum is not a persistant type (the value is replaced by the base type of the enum (int32 by default))
                //      because of that, we need to set the ItemsSource of the ComboBox to a list of the names (as strings) of the possible enum values.
                //      Otherwise, the value shown in the comboBox would be the base type value (so 0 or 1 for example).
                // Create a list of the enum's values' names and set it as the ItemsSource of the ComboBox:
                var  enumValuesAsStrings = new List <string>();
                Type valueType           = value.GetType();
                foreach (object val in enumValues)
                {
                    enumValuesAsStrings.Add(Enum.GetName(valueType, val));
                }
                cb.ItemsSource = enumValuesAsStrings;

                //Add a converter so that we go smoothly between the selected value in the ComboBox and the expected value in the source of the binding:
                b.Converter          = new MyConverter();
                b.ConverterParameter = valueType;
#else
                cb.ItemsSource = enumValues;
#endif

                cb.SetBinding(NativeComboBox.SelectedItemProperty, b);
            }
            return(cb);
        }
Esempio n. 7
0
        protected override void InitControls()
        {


            this.Text = CAPTION;
            this.Name = "Window1";
            //this.StatusBar = false;
            // this.Left = 100;
            //this.Top = 100;
            this.Width = 600;
            this.Height = 400;
            
            this._ControlTest = new ControlTest();
            this._ControlTest.Width = 200;
            this._ControlTest.Height = 30;
            this._ControlTest.Left = 300;
            this._ControlTest.Top = 80;
            this._ControlTest.Name = "TEST_CONTAINER";
            
            //this.BackColor = ColorTool.LightGray;
            this.StartUpPosition = WindowsStartupPosition.CenterScreen;
            this.BackColor = ColorTool.White;
            this._Timer = new NativeTimer();
            this._Timer.Interval = 100;
            //this._Timer.ControlId = 700;
            this._Timer.Tick += Timer_OnTick;
            this._Button = new NativeButton
            {
                Left = 10,
                Top = 10,
                Width = 100,
                Height = 30,
                Text = "Test",
                Name = "bnTest",
                BackColor = ColorTool.Blue,
                ForeColor = ColorTool.Green

            };

            this._Button1 = new NativeButton
            {
                Left = 150,
                Top = 10,
                Width = 100,
                Height = 30,
                Text = "Test",
                Name = "bnTest"//,
                //ControlId = 505
            };
            this._Button.Clicked += button_OnClicked;
            this._Button.DblClicked += button_OnDblClicked;
            this._Button1.Clicked += button1_OnClicked;
            this._Button1.DblClicked += button1_OnDblClicked;

            this._Button3 = new NativeButton
            {
                Location = new Point(300, 10),
                Width = 20,
                Height = 30,
                Name = "SelectFolder",
                Text = "…"
            };

            this._Button3.Clicked += Button3_Click;
            this._ComboBox = new NativeComboBox();
            this._ComboBox.Location = new Point(350, 10);
            
            this._ComboBox.Height = 30;
            this._ComboBox.Width = 200;
            this._ComboBox.Name = "cbbTest";
            this._ComboBox.ForeColor = ColorTool.Blue;
            this._ComboBox.BackColor = ColorTool.Green;
            this._ComboBox.Font = new Font() { Name = "Arial", Size = 10 };
            this._ComboBox.SelChange += ComboBox_SelChange;


            this._TextBox = new NativeTextBox
            {
                Left = 10,
                Top = 50,
                Width = 100,
                Height = 30,
                Text = "ATEST",
                Name = "txtTest",
                Font = new Font() { Name = "Arial", Size = 14 },
                ForeColor = ColorTool.Read
                //ControlId = 502
            };
            this._TextBox.Change += TextBox_Change;

            this._TextBox2 = new NativeTextBox
            {
                Left = 10,
                Top = 150,
                Width = 100,
                Height = 30,
                Text = "",
                Name = "txt2Test",
                //ControlId = 503,
                BackColor = ColorTool.Black,
                ForeColor = ColorTool.White

            };

            this._Label1 = new NativeLabel
            {
                Left = 10,
                Top = 200,
                Width = 100,
                Height = 30,
                Text = "Dies ist ein Label"//,
                                           //BackColor=ColorTool.Read,
                                           //ForeColor = ColorTool.Green,
                                           //ControlId = 504

            };
            this._Label1.Clicked += Label1_Click;
            this._Label1.DblClicked += Label1_DblClick;

            this._Bitmap = new NativeBitmap();
            this._Bitmap.BitMap = "Skype.bmp";
            this._Bitmap.Left = 150;
            this._Bitmap.Top = 50;
            this._Bitmap.Width = 100;
            this._Bitmap.Height = 100;

            this._CheckBox = new NativeCheckBox();
            this._CheckBox.Left = 300;
            this._CheckBox.Top = 50;
            this._CheckBox.Width = 200;
            this._CheckBox.Height = 30;
            this._CheckBox.Text = "TEST CHECKBOX";
            this._CheckBox.BackColor = ColorTool.White;
            this._CheckBox.Checked = true;

            this._ListBox = new NativeListBox();
            this._ListBox.Left = 300;
            this._ListBox.Top = 200;
            this._ListBox.Width = 400;
            this._ListBox.Height = 400;
            this._ListBox.BackColor = ColorTool.Yellow;
            this._ListBox.ForeColor = ColorTool.Read;
            this._ListBox.Font = new Font() { Name = "Arial", Size = 16 };
            this._ListBox.MultiSelect = true;
            this._ListBox.DblClicked+=ListBox_DblClicked;
            
            this._ListBox.SelChange+=ListBox_SelChange;

            this._ProgressBar = new NativeProgress
            {
                Left = 10,
                Top = 250,
                Width = 150,
                Height = 30//,
                //ControlId = 507
            };



            this._TextBox.Clicked += TextBox_Click;
            
            this.Controls.Add(this._Button);
            this.Controls.Add(this._Button1);
            this.Controls.Add(this._Button3);
            this.Controls.Add(this._ComboBox);
            this.Controls.Add(this._TextBox);
            this.Controls.Add(this._TextBox2);
            this.Controls.Add(this._Label1);
            this.Controls.Add(this._Bitmap);
            this.Controls.Add(this._CheckBox);
            this.Controls.Add(this._ListBox);
            this.Controls.Add(this._ProgressBar);
            this.Controls.Add(this._Timer);
            this.Controls.Add(this._ControlTest);
            Click += Window1_Click;
            DoubleClick += Window1_DblClick;
            Create += Window1_Create;
            this.MouseMove += Window1_MoseMove;
        }