public MainWindow(ClientObject cl)
 {
     InitializeComponent();
     client = cl;
     mw     = this;
     if (client.IsAdmin) // в залежості від користувача який входить в систему на головному меню відображаються різні кнопки
     {
         Button myAccount = new Button()
         {
             Name = "MyAccountButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Кабінет", Padding = new Thickness(25, 0, 25, 7)
         };
         myAccount.Click += MyAdminAccountButton_Click;
         Button studentsButton = new Button()
         {
             Name = "StudentsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Студенти", Padding = new Thickness(25, 0, 25, 7)
         };
         studentsButton.Click += StudentsButton_Click;
         Button groupsButton = new Button()
         {
             Name = "GroupsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Групи", Padding = new Thickness(25, 0, 25, 7)
         };
         groupsButton.Click += GroupsButton_Click;
         Button testsButton = new Button()
         {
             Name = "TestsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Тести", Padding = new Thickness(25, 0, 25, 7)
         };
         testsButton.Click += TestsButton_Click;
         Button subjectsButton = new Button()
         {
             Name = "SubjectsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Предмети", Padding = new Thickness(25, 0, 25, 7)
         };
         subjectsButton.Click += AdminSubjectButton_Click;
         Button testSessionsButton = new Button()
         {
             Name = "TestSessionsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Тестові сесії", Padding = new Thickness(25, 0, 25, 7)
         };
         testSessionsButton.Click += AdminTestSessionsButton_Click;
         Button logOutButton = new Button()
         {
             Name = "LogOutButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Вихід", Padding = new Thickness(25, 0, 25, 7)
         };
         logOutButton.Click += LogOutButton_Click;
         buttonsStackPanel.Children.Add(myAccount);
         buttonsStackPanel.Children.Add(studentsButton);
         buttonsStackPanel.Children.Add(groupsButton);
         buttonsStackPanel.Children.Add(subjectsButton);
         buttonsStackPanel.Children.Add(testsButton);
         buttonsStackPanel.Children.Add(testSessionsButton);
         buttonsStackPanel.Children.Add(logOutButton);
     }
     else
     {
         Button myStudentAccount = new Button()
         {
             Name = "MyStudentAccountButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Кабінет", Padding = new Thickness(25, 0, 25, 7)
         };
         myStudentAccount.Click += MyStudentAccountButton_Click;
         Button testsButton = new Button()
         {
             Name = "testsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Тести", Padding = new Thickness(25, 0, 25, 7)
         };
         testsButton.Click += TestsButton_Click;
         Button resultsButton = new Button()
         {
             Name = "resultsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Результати", Padding = new Thickness(25, 0, 25, 7)
         };
         resultsButton.Click += ResultsButton_Click;
         Button logOutButton = new Button()
         {
             Name = "LogOutButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Вихід", Padding = new Thickness(25, 0, 25, 7)
         };
         buttonsStackPanel.Children.Add(myStudentAccount);
         buttonsStackPanel.Children.Add(testsButton);
         buttonsStackPanel.Children.Add(resultsButton);
         buttonsStackPanel.Children.Add(logOutButton);
         logOutButton.Click += LogOutButton_Click;
     }
 }
Exemple #2
0
 public ChangeUserPassword(ClientObject cl, string passw)
 {
     InitializeComponent();
     client   = cl;
     password = passw;
 }
 public MainWindow(ClientObject cl)
 {
     InitializeComponent();
     client = cl;
     if (client.IsAdmin) // в залежості від користувача який входить в систему на головному меню відображаються різні кнопки
     {
         Button myAccount = new Button()
         {
             Name = "MyAccountButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "My Account", Padding = new Thickness(25, 0, 25, 7)
         };
         myAccount.Click += MyAdminAccountButton_Click;
         Button studentsButton = new Button()
         {
             Name = "StudentsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Students", Padding = new Thickness(25, 0, 25, 7)
         };
         studentsButton.Click += StudentsButton_Click;
         Button groupsButton = new Button()
         {
             Name = "GroupsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Groups", Padding = new Thickness(25, 0, 25, 7)
         };
         groupsButton.Click += GroupsButton_Click;
         Button testsButton = new Button()
         {
             Name = "TestsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Tests", Padding = new Thickness(25, 0, 25, 7)
         };
         Button subjectsButton = new Button()
         {
             Name = "SubjectsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Subjects", Padding = new Thickness(25, 0, 25, 7)
         };
         Button testSessionsButton = new Button()
         {
             Name = "TestSessionsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Test Sessions", Padding = new Thickness(25, 0, 25, 7)
         };
         Button logOutButton = new Button()
         {
             Name = "LogOutButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Log out", Padding = new Thickness(25, 0, 25, 7)
         };
         logOutButton.Click += LogOutButton_Click;
         buttonsStackPanel.Children.Add(myAccount);
         buttonsStackPanel.Children.Add(studentsButton);
         buttonsStackPanel.Children.Add(groupsButton);
         buttonsStackPanel.Children.Add(testsButton);
         buttonsStackPanel.Children.Add(testSessionsButton);
         buttonsStackPanel.Children.Add(logOutButton);
     }
     else
     {
         Button myStudentAccount = new Button()
         {
             Name = "MyStudentAccountButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "My Account", Padding = new Thickness(25, 0, 25, 7)
         };
         myStudentAccount.Click += MyStudentAccountButton_Click;
         Button testsButton = new Button()
         {
             Name = "testsButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Tests", Padding = new Thickness(25, 0, 25, 7)
         };
         Button logOutButton = new Button()
         {
             Name = "LogOutButton", Background = Brushes.Blue, FontSize = 15, Foreground = Brushes.White, Content = "Log out", Padding = new Thickness(25, 0, 25, 7)
         };
         buttonsStackPanel.Children.Add(myStudentAccount);
         buttonsStackPanel.Children.Add(testsButton);
         buttonsStackPanel.Children.Add(logOutButton);
         logOutButton.Click += LogOutButton_Click;
     }
 }
Exemple #4
0
        private void LogOnServer()
        {
            try
            {
                m_compIP = GetCompIP(Dns.GetHostName().ToLower());

                BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
                serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();

                IDictionary props = new Hashtable();
                props["port"] = portClient;
                props["name"] = "";
                clientChannel = new TcpChannel(props, clientProv, serverProv);
                ChannelServices.RegisterChannel(clientChannel, false);
                ClientObj = new ClientObject(this);
                m_obj     = RemotingServices.Marshal(ClientObj, "ClientObject.soap");

                String serverURL = "tcp://" + ipAddressServer + ":" + portServer.ToString() + "/ServerObject.rem";
                ServerObj = (IServerObject)Activator.GetObject(typeof(IServerObject), serverURL);
                RSend.ClientInfo ClData = new RSend.ClientInfo(userName, info, m_compIP, portClient, DateTime.Now);

                if (ServerObj.Logon(ClData))
                {
                    b_IsConnected = true;

                    // selftest block begin
                    if (selftest)
                    {
                        List <String> ListSendServer = new List <string>();
                        ListSendServer.Add(userName);
                        ServerObj.SendMessageToServer(userName, ListSendServer, "selftest", false);

                        int i     = 0;
                        int count = (int)(Math.Round((double)timeoutSelftest / 1000 * 2));

                        while (i < count)
                        {
                            if (selftestResult)
                            {
                                i = count;
                            }
                            else
                            {
                                System.Threading.Thread.Sleep(500);
                                i++;
                            }
                        }

                        if (selftestResult)
                        {
                            Online();
                        }
                        else
                        {
                            LogOffServer();
                        }
                    }
                    // selftest block end
                    else
                    {
                        Online();
                    }
                }
                else
                {
                    b_IsConnected = false;
                    LogOffServer();
                }
            }
            catch
            {
                Offline();
            }
        }
Exemple #5
0
 public LoginWindow()
 {
     InitializeComponent();
     client = new ClientObject();
 }