Exemplo n.º 1
0
        private void btnDone_Click(object sender, RoutedEventArgs e)
        {
            foreach (Typer typer in lbTypers.Items)
            {
                if (typer.FKey == cbFKey.SelectedIndex + 1)
                {
                    new AlliSharp.AlliSharpMessageBox(this.Title, "The F Key chosen is already in use by another typer.");
                    return;
                }
            }
            if (tbTextToType.Text.Contains("{F" + (cbFKey.SelectedIndex + 1).ToString() + "}"))
            {
                if (cbSendKeys.IsChecked.Value)
                {
                    new AlliSharp.AlliSharpMessageBox(this.Title, "Please do not try to cause infinite loops with the auto-typer. Thanks, allisharp.com ;)");
                    return;
                }
            }

            Typer nt = new Typer(tbTextToType.Text, cbFKey.SelectedIndex + 1, cbSendKeys.IsChecked.Value, cbPressEnter.IsChecked.Value, cbIsActive.IsChecked.Value);

            if (cbIsActive.IsChecked.Value)
            {
                nt.hotKeyId = hotKeyManager.RegisterFKey(cbFKey.SelectedIndex + 1);
            }

            lbTypers.Items.Add(nt);

            tabAddNew.Visibility  = Visibility.Collapsed;
            tabDefault.Visibility = Visibility.Visible;
            //throw new Exception("asdasd");
        }
Exemplo n.º 2
0
 private void btnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (lbTypers.SelectedItem != null)
     {
         if (lbTypers.SelectedItem as Typer != null)
         {
             Typer typer = lbTypers.SelectedItem as Typer;
             edittedtyper             = typer;
             tabAddNew.Visibility     = Visibility.Collapsed;
             tabDefault.Visibility    = Visibility.Visible;
             tbTextToType.Text        = typer.Text;
             cbFKey.SelectedIndex     = typer.FKey - 1;
             cbPressEnter.IsChecked   = typer.PressEnter;
             cbIsActive.IsChecked     = typer.IsActive;
             cbSendKeys.IsChecked     = typer.SendKeys;
             tabAddNew.Visibility     = Visibility.Visible;
             tabDefault.Visibility    = Visibility.Collapsed;
             btnDone.Visibility       = Visibility.Collapsed;
             btnEditDone.Visibility   = Visibility.Visible;
             btnEditDelete.Visibility = Visibility.Visible;
         }
     }
 }