public string ButtonEntry_EmulateClickAndGetMessage()
        {
            Async async = new Async();

            ButtonEntry.EmulateClick(async);
            var msgBox = new NativeMessageBox(Window.WaitForNextModal());
            var msg    = msgBox.Message;

            msgBox.EmulateButtonClick("OK");
            async.WaitForCompletion();
            return(msg);
        }
Beispiel #2
0
    public static void Main()
    {
        // Load data...
        var data = new List <string>
        {
            "buttons=2",
            ";",
            "button_text_01=a",
            "button_text_02=b",
            "button_program_02=p",
            "button_bckcolor_02=c",
        };

        // Find number of buttons.
        string buttonString = ReadData(data, "buttons");
        int    buttonCount  = int.Parse(buttonString);

        var buttons = new List <ButtonEntry>();

        // Fill each button.
        for (int b = 1; b <= buttonCount; b++)
        {
            var button = new ButtonEntry
            {
                Number = b
            };

            string needle = "button_text_" + b.ToString("D2");
            button.Text            = ReadData(data, needle);
            needle                 = "button_program_" + b.ToString("D2");
            button.Program         = ReadData(data, needle);
            needle                 = "button_bckcolor_" + b.ToString("D2");
            button.BackgroundColor = ReadData(data, needle);

            buttons.Add(button);
        }

        foreach (var button in buttons)
        {
            Console.WriteLine("Button {0}: {1}, {2}, {3}", button.Number, button.Text, button.Program, button.BackgroundColor);
        }
    }
        private void btnBBarAdd_Click(object sender, RoutedEventArgs e)
        {
            int sel = lstButtonBarPool.SelectedIndex;

            if (sel == -1)
            {
                return;
            }
            ButtonEntry entry = ButtonPool[sel];

            if (entry.Order == QTButtonBar.BII_SEPARATOR)
            {
                entry = new ButtonEntry(this, 0, QTButtonBar.BII_SEPARATOR);
            }
            else
            {
                ButtonPool.RemoveAt(sel);
                if (sel == ButtonPool.Count)
                {
                    --sel;
                }
                if (sel >= 0)
                {
                    lstButtonBarPool.SelectedIndex = sel;
                    lstButtonBarPool.ScrollIntoView(lstButtonBarPool.SelectedItem);
                }
            }
            if (lstButtonBarCurrent.SelectedIndex == -1)
            {
                CurrentButtons.Add(entry);
                lstButtonBarCurrent.SelectedIndex = CurrentButtons.Count - 1;
            }
            else
            {
                CurrentButtons.Insert(lstButtonBarCurrent.SelectedIndex + 1, entry);
                lstButtonBarCurrent.SelectedIndex++;
            }
            lstButtonBarCurrent.ScrollIntoView(lstButtonBarCurrent.SelectedItem);
        }
        private void btnBBarRemove_Click(object sender, RoutedEventArgs e)
        {
            int sel = lstButtonBarCurrent.SelectedIndex;

            if (sel == -1)
            {
                return;
            }
            ButtonEntry entry = CurrentButtons[sel];

            CurrentButtons.RemoveAt(sel);
            if (sel == CurrentButtons.Count)
            {
                --sel;
            }
            if (sel >= 0)
            {
                lstButtonBarCurrent.SelectedIndex = sel;
                lstButtonBarCurrent.ScrollIntoView(lstButtonBarCurrent.SelectedItem);
            }
            if (entry.Order != QTButtonBar.BII_SEPARATOR)
            {
                int i = 0;
                while (i < ButtonPool.Count && ButtonPool[i].Order < entry.Order)
                {
                    ++i;
                }
                ButtonPool.Insert(i, entry);
                lstButtonBarPool.SelectedIndex = i;
            }
            else
            {
                lstButtonBarPool.SelectedIndex = 0;
            }
            lstButtonBarPool.ScrollIntoView(lstButtonBarPool.SelectedItem);
        }
 public void ButtonEntry_EmulateClickAndClose()
 {
     ButtonEntry.EmulateClick();
     Async.WaitForCompletion();
 }
 private void btnBBarAdd_Click(object sender, RoutedEventArgs e) {
     int sel = lstButtonBarPool.SelectedIndex;
     if(sel == -1) return;
     ButtonEntry entry = ButtonPool[sel];
     if(entry.Order == QTButtonBar.BII_SEPARATOR) {
         entry = new ButtonEntry(this, 0, QTButtonBar.BII_SEPARATOR);
     }
     else {
         ButtonPool.RemoveAt(sel);
         if(sel == ButtonPool.Count) --sel;
         if(sel >= 0) {
             lstButtonBarPool.SelectedIndex = sel;
             lstButtonBarPool.ScrollIntoView(lstButtonBarPool.SelectedItem);
         }
     }
     if(lstButtonBarCurrent.SelectedIndex == -1) {
         CurrentButtons.Add(entry);
         lstButtonBarCurrent.SelectedIndex = CurrentButtons.Count - 1;
     }
     else {
         CurrentButtons.Insert(lstButtonBarCurrent.SelectedIndex + 1, entry);
         lstButtonBarCurrent.SelectedIndex++;
     }
     lstButtonBarCurrent.ScrollIntoView(lstButtonBarCurrent.SelectedItem);
 }