private void ScheduleSchemeLoaded(object sender, RoutedEventArgs e)
        {
            kalendar.BeginInit();
            kalendar.TimetableSettings.Dates.Clear();

            /// Popunjavanje kalendara danima u sedmici <see cref="ScheduleDays"/>
            for (int i = 0; i < 6; i++)
            {
                kalendar.TimetableSettings.Dates.Add(ScheduleDays.workDays[i]);
            }

            kalendar.EndInit();

            // Samo ovdje se inicijalizuje! Je l' ovo dobar Trenutak?
            MainWindowParent = (MainWindow)Window.GetWindow(this);

            if (IsVisible == true)
            {
                ButtonAutomationPeer bap = new ButtonAutomationPeer(ButtonZatvori);
                bap.SetFocus();
            }
            else
            {
                kalendar.Focus();
            }
        }
Esempio n. 2
0
        private static void DefaultButtonChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var uiElement = sender as UIElement;
            var button    = e.NewValue as Button;

            if (uiElement != null && button != null)
            {
                uiElement.KeyUp += (s, arg) =>
                {
                    var peer = new ButtonAutomationPeer(button);
                    if (arg.Key == Key.Enter)
                    {
                        peer.SetFocus();
                        uiElement.Dispatcher.BeginInvoke((Action) delegate
                        {
                            var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                            if (invokeProv != null)
                            {
                                invokeProv.Invoke();
                            }
                        });
                    }
                };
            }
        }
Esempio n. 3
0
        private static void ButtonOnKeyUp(object sender, KeyEventArgs args)
        {
            var peer = new ButtonAutomationPeer(sender as Button);

            if (args.Key == Key.Enter)
            {
                peer.SetFocus();
                (sender as Button).Dispatcher
                .BeginInvoke(() =>
                {
                    var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                    if (invokeProv != null)
                    {
                        invokeProv.Invoke();
                    }
                });
            }
        }
 private void HandleKeyUp(object sender, KeyEventArgs e)
 {
     if (FocusManager.GetFocusedElement() == AssociatedObject &&
         e.Key == Key.Enter &&
         DefaultButton != null)
     {
         var peer = new ButtonAutomationPeer(DefaultButton);
         peer.SetFocus();
         AssociatedObject.Dispatcher.BeginInvoke(delegate
         {
             var invokeProv =
                 peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
             if (invokeProv != null)
             {
                 invokeProv.Invoke();
             }
         });
     }
 }
        private static void HelpMoveMouse(System.Drawing.Point mousePoint, System.Drawing.Point componentPoint,
                                          FrameworkElement targetElement, Dispatcher dispatcher)
        {
            Console.WriteLine("T A C K E  sleep 0.5 s");
            Thread.Sleep(500);

            bool mouseXSmaller = false;
            bool mouseYSmaller = false;

            if (mousePoint.X < componentPoint.X)
            {
                mouseXSmaller = true;
            }
            if (mousePoint.Y < componentPoint.Y)
            {
                mouseYSmaller = true;
            }
            bool xReached = false;
            bool yReached = false;

            // mis na manjoj poziciji po x i po y
            #region mis x i y manji
            if (mouseXSmaller && mouseYSmaller)
            {
                while (xReached != true)
                {
                    if (mousePoint.X != componentPoint.X)
                    {
                        mousePoint.X = mousePoint.X + 1;
                    }
                    else
                    {
                        xReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                    //Console.WriteLine("mousePoint X: " + mousePoint.X + " mousePoint Y: " + mousePoint.Y);
                    //Console.WriteLine("componentP X: " + componentPoint.X + " componentP Y: " + componentPoint.Y);
                }
                while (yReached != true)
                {
                    if (mousePoint.Y != componentPoint.Y)
                    {
                        mousePoint.Y = mousePoint.Y + 1;
                    }
                    else
                    {
                        yReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
            }
            #endregion

            #region mis x manji, mis y NIJE manji
            if (mouseXSmaller && !mouseYSmaller)
            {
                while (xReached != true)
                {
                    if (mousePoint.X != componentPoint.X)
                    {
                        mousePoint.X = mousePoint.X + 1;
                    }
                    else
                    {
                        xReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
                while (yReached != true)
                {
                    if (mousePoint.Y != componentPoint.Y)
                    {
                        mousePoint.Y = mousePoint.Y - 1;
                    }
                    else
                    {
                        yReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
            }
            #endregion

            #region mis x NIJE manji, mis y manji
            if (!mouseXSmaller && mouseYSmaller)
            {
                while (xReached != true)
                {
                    if (mousePoint.X != componentPoint.X)
                    {
                        mousePoint.X = mousePoint.X - 1;
                    }
                    else
                    {
                        xReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
                while (yReached != true)
                {
                    if (mousePoint.Y != componentPoint.Y)
                    {
                        mousePoint.Y = mousePoint.Y + 1;
                    }
                    else
                    {
                        yReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
            }
            #endregion

            #region  mis x NIJE manji, mis y NIJE manji
            if (!mouseXSmaller && !mouseYSmaller)
            {
                while (xReached != true)
                {
                    if (mousePoint.X != componentPoint.X)
                    {
                        mousePoint.X = mousePoint.X - 1;
                    }
                    else
                    {
                        xReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
                while (yReached != true)
                {
                    if (mousePoint.Y != componentPoint.Y)
                    {
                        mousePoint.Y = mousePoint.Y - 1;
                    }
                    else
                    {
                        yReached = true;
                    }
                    //Microsoft.Test.Input.Mouse.MoveTo(mousePoint);
                    Thread.Sleep(3);
                }
            }
            #endregion

            dispatcher.Invoke(() =>
            {
                ButtonAutomationPeer peer =
                    new ButtonAutomationPeer((System.Windows.Controls.Button)targetElement);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke)
                                             as IInvokeProvider;

                peer.SetFocus();
                invokeProv.Invoke();
            });
        }
Esempio n. 6
0
        private void demoMode() // DemoMode.DemoModeWindow demoModeWindow
        {
            #region unos učionice

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = "\nI - Dodavanje učionice\n"
                                                             + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber +
                                                             ". Kliknemo na dugme Dodaj učionicu u gornjem desnom uglu ekrana\n"
                                                             + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() => {
                ButtonAutomationPeer peer =
                    new ButtonAutomationPeer(dodajUcionicuDugme);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke)
                                             as IInvokeProvider;

                peer.SetFocus();
                invokeProv.Invoke();
            });
            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Kliknemo na polje identifikatora učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() => {
                TextBoxAutomationPeer peer = new TextBoxAutomationPeer(ClassroomForma.Identificator);
                peer.SetFocus();
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Unesemo identifikator nove učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() => { ClassroomForma.Identificator.Text = "L-52"; });
            Thread.Sleep(2000);

            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Kliknemo na polje opisa učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() => {
                TextBoxAutomationPeer peer = new TextBoxAutomationPeer(ClassroomForma.Description);
                peer.SetFocus();
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Unesemo opis učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() => { ClassroomForma.Description.Text = "Opis učionice"; });
            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Unesemo broj radnika\n\n" + demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(2500);

            Dispatcher.Invoke(() => { ClassroomForma.brojMijestaUpDown.Value = 3; });
            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Odaberemo operativni sistem\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() => {
                ComboBoxAutomationPeer peer = new ComboBoxAutomationPeer(ClassroomForma.OperatingSystem);
                peer.SetFocus();
                IExpandCollapseProvider provider = (IExpandCollapseProvider)
                                                   peer.GetPattern(PatternInterface.ExpandCollapse);
                provider.Expand();
            });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() => { ClassroomForma.OperatingSystem.SelectedIndex = 2; });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() => {
                ComboBoxAutomationPeer peer = new ComboBoxAutomationPeer(ClassroomForma.OperatingSystem);
                peer.SetFocus();
                IExpandCollapseProvider provider = (IExpandCollapseProvider)
                                                   peer.GetPattern(PatternInterface.ExpandCollapse);
                provider.Collapse();
            });

            Thread.Sleep(3000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Odaberemo instalirani softver iz liste\n\n" + demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(5500);

            Dispatcher.Invoke(() => {
                ListBoxAutomationPeer peer = new ListBoxAutomationPeer(ClassroomForma.SoftwaresList);
                peer.SetFocus();
                ClassroomForma.SoftwaresList.SelectedIndex = 2;
            });
            Thread.Sleep(2000);
            Dispatcher.Invoke(() => { ClassroomForma.SoftwaresList.SelectedIndex = 4; });

            Thread.Sleep(3000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Označimo opremu koja postoji. Tablu nemamo, ali imamo projektor\n\n" + demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(5500);

            Dispatcher.Invoke(() => {
                ClassroomForma.TableNeeded.IsChecked     = false;
                ClassroomForma.ProjectorNeeded.IsChecked = true;
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Potvrdimo unos\n\n" + demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(3000);
            Dispatcher.Invoke(() =>
            {
                ButtonAutomationPeer peer =
                    new ButtonAutomationPeer(ClassroomForma.Potvrda);
                peer.SetFocus();
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                ButtonAutomationPeer peer  = new ButtonAutomationPeer(ClassroomForma.Potvrda);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();

                demoModeWindow.demoNumber = 0;
            });

            Thread.Sleep(1000);
            Console.WriteLine("444444444444");

            #endregion unos učionice

            #region pregled učionica
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = "\nII Pregled učionica\n\n" +
                                                             demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber +
                                                             ". Odaberemo meni Tabele\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);


            Dispatcher.Invoke(() =>
            {
                MenuItemAutomationPeer peer =
                    new MenuItemAutomationPeer(this.MeniTabele);

                IExpandCollapseProvider provider = (IExpandCollapseProvider)
                                                   peer.GetPattern(PatternInterface.ExpandCollapse);
                provider.Expand();
            });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber + ". Odaberemo stavku Učionice\n\n"
                                                             + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                MenuItemAutomationPeer peer = new MenuItemAutomationPeer(this.MeniItemUcionice);
                peer.SetFocus();
            });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                MenuItemAutomationPeer peer = new MenuItemAutomationPeer(this.MeniItemUcionice);
                IInvokeProvider invokeProv  = peer.GetPattern(PatternInterface.Invoke)
                                              as IInvokeProvider;

                peer.SetFocus();
                invokeProv.Invoke();
            });

            Thread.Sleep(2000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber + ". Sada vidimo tabelu sa učionicama" +
                                                             " gdje možemo svaku od njih obrisati ili izmijeniti\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            #endregion

            #region izmjena učionice
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = "\nIII Izmjena učionice\n\n" +
                                                             demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(4000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber +
                                                             ". Izmijenićemo jednu učionicu, klikom na dugme Izmijeni u prvom redu\n\n" +
                                                             demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(4000);
            Dispatcher.Invoke(() =>
            {
                this.ClassroomTabela.ClassroomsList.SelectedItem = 1;
                ClassroomHandler.Instance.SetSelectedClassroom(ClassroomTabela.Classrooms[0], (MainWindow)Window.GetWindow(this));
                ((MainWindow)Window.GetWindow(this)).NovaUcionica_Show();
            });
            Thread.Sleep(4000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Kliknemo na polje opisa učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() => {
                TextBoxAutomationPeer peer = new TextBoxAutomationPeer(ClassroomForma.Description);
                peer.SetFocus();
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Unesemo novi opis učionice\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() => { ClassroomForma.Description.Text = "Novi opis za L-42"; });

            Thread.Sleep(3000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Izmijenimo postojeću opremu. Kupili smo pametnu tablu.\n\n" + demoModeWindow.currentDemoDescription.Text;
            });
            Thread.Sleep(5000);

            Dispatcher.Invoke(() => {
                ClassroomForma.SmartTableNeeded.IsChecked = true;
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber
                                                             + ". Potvrdimo unos.\n\n" + demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);
            Dispatcher.Invoke(() =>
            {
                ButtonAutomationPeer peer =
                    new ButtonAutomationPeer(ClassroomForma.Potvrda);
                peer.SetFocus();
            });

            Thread.Sleep(2000);
            Dispatcher.Invoke(() =>
            {
                ButtonAutomationPeer peer  = new ButtonAutomationPeer(ClassroomForma.Potvrda);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber +
                                                             ". Nakon unosa ponovo vidimo prikaz svih učionica, te možemo vidjeti " +
                                                             "da je njen identifikator izmijenjen.\n\n" + demoModeWindow.currentDemoDescription.Text;

                demoModeWindow.demoNumber = 0;
            });

            Thread.Sleep(5000);
            #endregion

            #region brisanje učionice
            Dispatcher.Invoke(() =>
            {
                demoModeWindow.demoNumber = 0;
                demoModeWindow.currentDemoDescription.Text = "\nIV Brisanje učionice\n\n" +
                                                             demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(3000);

            Dispatcher.Invoke(() =>
            {
                demoModeWindow.currentDemoDescription.Text = demoModeWindow.demoNumber +
                                                             ". Obrisaćemo jednu učionicu, recimo prvu, klikom na dugme Obriši u prvom redu\n\n" +
                                                             demoModeWindow.currentDemoDescription.Text;
            });

            Thread.Sleep(4000);
            Dispatcher.Invoke(() =>
            {
                this.ClassroomTabela.ClassroomsList.SelectedItem = 1;
                ClassroomHandler.Instance.SetSelectedClassroom(ClassroomTabela.Classrooms[0], (MainWindow)Window.GetWindow(this));
                ClassroomHandler.Instance.Remove(ClassroomHandler.Instance.SelectedClassroom.Id, (MainWindow)Window.GetWindow(this));
            });
            Thread.Sleep(4000);
            #endregion
        }