Exemplo n.º 1
0
        public static void AddTypeDemon(AddType addType)
        {
            System.Windows.Point absolutePos = new System.Windows.Point(0, 0);
            absolutePos    = getElementPos(addType.NameTextBox);
            absolutePos.X += 30;
            absolutePos.Y += 10;
            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);

            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);

            fillTextBox(addType.NameTextBox, "Demonic type");

            System.Windows.Forms.SendKeys.SendWait("{TAB}");
            fillTextBox(addType.DescriptionTextBox, "A very demonic type of monuments");

            System.Windows.Forms.SendKeys.SendWait("{TAB}");
            fillTextBox(addType.IconTextBox, @"C:\Users\Nenad\Desktop\test.png");

            absolutePos    = getElementPos(addType.AddTypeButton);
            absolutePos.X += 10;
            absolutePos.Y += 10;
            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);
            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);
        }
Exemplo n.º 2
0
 private void AddType_Click(object sender, RoutedEventArgs e)
 {
     emlekmu.AddType dialog = new emlekmu.AddType(this.AddTypeCallBack, this.Types);
     dialog.Owner = Application.Current.MainWindow;
     dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     dialog.Height    = 490;
     dialog.Width     = 350;
     dialog.MinHeight = 420;
     dialog.MinWidth  = 280;
     dialog.Show();
 }
        private void AddTypeCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            AddType dialog = new AddType(this.AddTypeCallback, this.Types);

            dialog.Owner = Application.Current.MainWindow;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            dialog.Height    = 490;
            dialog.Width     = 350;
            dialog.MinHeight = 420;
            dialog.MinWidth  = 280;
            dialog.ShowDialog();
        }
        private void AddTypeButton_Click(object sender, RoutedEventArgs e)
        {
            AddType addTypeDialog = new AddType(AddTypeCallback, Types);

            addTypeDialog.Owner = Application.Current.MainWindow;
            addTypeDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            addTypeDialog.Height    = 490;
            addTypeDialog.Width     = 350;
            addTypeDialog.MinHeight = 420;
            addTypeDialog.MinWidth  = 280;

            this.AddTypeDemonDialog = addTypeDialog;

            addTypeDialog.ShowDialog();

            if (addTypeDialog.DialogResult.HasValue && addTypeDialog.DialogResult.Value)
            {
                Scroller.ScrollToBottom();
                this.UpdateLayout();
                this.typeClicked(addTypeDialog.newType.Id);
            }
        }
Exemplo n.º 5
0
        public static void TypeSectionDemon(TypeSection typeSection)
        {
            System.Windows.Point absolutePos = new System.Windows.Point(0, 0);
            absolutePos    = getElementPos(typeSection.AddTypeButton);
            absolutePos.X += 30;
            absolutePos.Y += 10;
            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);
            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);

            Thread.Sleep(1000);
            bool    done    = false;
            AddType addType = null;

            typeSection.Dispatcher.Invoke(() =>
            {
                addType = typeSection.AddTypeDemonDialog;
                done    = true;
            });
            while (!done)
            {
            }

            AddTypeDemon(addType);


            Thread.Sleep(1000);


            //Finds the edit button
            TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot);
            List <TypeRowDetail> myList = new List <TypeRowDetail>();

            done = false;
            TypeRowDetail rowDetail = null;

            typeSection.Dispatcher.Invoke(() =>
            {
                foreach (TypeRowDetail m in TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot))
                {
                    if (m.Tag.Equals(typeSection.EnlargenedTypes.SingleOrDefault()))
                    {
                        rowDetail   = m;
                        absolutePos = getElementPos(m.EditTagButton);
                        done        = true;
                    }
                }
            });
            while (!done)
            {
            }
            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);
            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);

            Thread.Sleep(1000);

            EditTypeDemon(typeSection.EditTypeDemonDialog);


            //Finds the delete button
            myList    = new List <TypeRowDetail>();
            done      = false;
            rowDetail = null;
            typeSection.Dispatcher.Invoke(() =>
            {
                foreach (TypeRowDetail m in TypeSection.FindVisualChildren <TypeRowDetail>(typeSection.RootWoot))
                {
                    if (m.Tag.Equals(typeSection.EnlargenedTypes.SingleOrDefault()))
                    {
                        rowDetail   = m;
                        absolutePos = getElementPos(m.DeleteTagButton);
                        done        = true;
                    }
                }
            });
            while (!done)
            {
            }

            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);
            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);

            Thread.Sleep(1000);

            System.Windows.Forms.SendKeys.SendWait("{ENTER}");

            absolutePos    = getElementPos(typeSection.CloseButton);
            absolutePos.X += 30;
            absolutePos.Y += 10;
            MoveCursorSlowly((int)absolutePos.X, (int)absolutePos.Y);
            MouseEvent(MouseEventFlags.LeftDown);
            Thread.Sleep(200);
            MouseEvent(MouseEventFlags.LeftUp);
        }