示例#1
0
        private void LaunchQuestionDialog(String questionID, ListBoxRow row)
        {
            var questionDialog = new QuestionDialog(questions[questionID], this, row);

            DepartmentApp.GetApp().AddWindow(questionDialog);
            questionDialog.ShowAll();
        }
示例#2
0
        private async Task AuthenticateUser()
        {
            var email = emailBox.Text;
            var pass  = passwordBox.Text;

            var loginBody = new JObject();

            loginBody["email"]    = email;
            loginBody["password"] = pass;

            var response = await DepartmentApp.PostRequest("/api/auth/login", loginBody);

            if (response == null)
            {
                return;
            }

            DepartmentApp.SetJwt(response["auth_token"].ToString());
            DepartmentApp.SetEmail(response["email"].ToString());

            var mainWindow = new MainWindow();

            DepartmentApp.GetApp().AddWindow(mainWindow);
            mainWindow.ShowAll();

            DepartmentApp.GetApp().RemoveWindow(this);
            this.Hide();
        }
示例#3
0
        private void RegisterButton_Clicked(object sender, EventArgs a)
        {
            var registerWindow = new RegisterWindow();

            DepartmentApp.GetApp().AddWindow(registerWindow);
            registerWindow.ShowAll();

            DepartmentApp.GetApp().RemoveWindow(this);
            this.Hide();
        }
示例#4
0
        private void LoginButton_Clicked(object sender, EventArgs a)
        {
            var loginWindow = new LoginWindow();

            DepartmentApp.GetApp().AddWindow(loginWindow);
            loginWindow.ShowAll();

            DepartmentApp.GetApp().RemoveWindow(this);
            this.Hide();
        }
示例#5
0
        private async Task AutheticateSolver()
        {
            var email = emailBox.Text;
            var name  = nameBox.Text;
            var pass  = passBox.Text;
            var conf  = confBox.Text;

            var registerBody = new JObject();

            registerBody["email"]        = email;
            registerBody["username"]     = name;
            registerBody["password"]     = pass;
            registerBody["passwordConf"] = conf;
            registerBody["role"]         = "solver";

            var response = await DepartmentApp.PostRequest("/api/users/", registerBody);

            if (response == null)
            {
                return;
            }

            var loginBody = new JObject();

            loginBody["email"]    = email;
            loginBody["password"] = pass;

            var loginResponse = await DepartmentApp.PostRequest("/api/auth/login", loginBody);

            if (loginResponse == null)
            {
                return;
            }

            DepartmentApp.SetJwt(loginResponse["auth_token"].ToString());
            DepartmentApp.SetEmail(loginResponse["email"].ToString());

            var mainWindow = new MainWindow();

            DepartmentApp.GetApp().AddWindow(mainWindow);
            mainWindow.ShowAll();

            DepartmentApp.GetApp().RemoveWindow(this);
            this.Hide();
        }
示例#6
0
        public static void Main(string[] args)
        {
            DotNetEnv.Env.Load();
            Application.Init();

            var app = new Application(null, GLib.ApplicationFlags.None);

            app.Register(GLib.Cancellable.Current);

            DepartmentApp.Init(app);

            var win = new LoginWindow();

            app.AddWindow(win);

            win.Show();
            Application.Run();
        }
示例#7
0
        private async Task sendAnswer()
        {
            var endpoint    = $"/api/solver/{question.issueID}/questions/{question.ID}";
            var answer      = answerBox.Buffer.Text;
            var requestBody = new JObject();

            requestBody["answer"] = answer;

            var response = await DepartmentApp.PutRequest(endpoint, requestBody);

            if (response["statusCode"].ToString() != "OK")
            {
                return;
            }

            row.Hide();
            mainWindow.questionsList.Remove(row);

            mainWindow.SaveData();

            mainWindow.questions.Remove(question.Text);
            this.Hide();
            DepartmentApp.GetApp().RemoveWindow(this);
        }
示例#8
0
 private void CloseButton_Clicked(object sender, EventArgs args)
 {
     this.Hide();
     DepartmentApp.GetApp().RemoveWindow(this);
 }
示例#9
0
 private void Window_DeleteEvent(object sender, DeleteEventArgs args)
 {
     DepartmentApp.GetApp().RemoveWindow(this);
 }