Beispiel #1
0
        private void DatabaseForm_Load(object sender, EventArgs e)
        {
            LoginForm loginForm = new LoginForm();
            loginForm.ShowDialog(this);

            if (loginForm.Service == null)
            {
                return;
            }

            this.service = loginForm.Service;
            this.localDb = new LocalDb(service);

        }
Beispiel #2
0
        public LocalDb(ActivityInfoService service)
        {
            this.service = service;

            var builder = new SQLiteConnectionStringBuilder();
            builder.DataSource = Application.UserAppDataPath + "\\ActivityInfo.db";

            connection = new SQLiteConnection(builder.ToString());
            connection.Open();

            executeSQL("create table if not exists sync_regions (id TEXT, localVersion INTEGER)");
            executeSQL("create table if not exists sync_history (lastUpdate INTEGER)");

            regionEnum = service.GetSyncRegions().List.GetEnumerator();
        }
Beispiel #3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            try
            {
                String serverUrl = serverCombo.Text;
                if (!serverUrl.EndsWith("/"))
                {
                    serverUrl += "/";
                }
                service = new ActivityInfoService(serverUrl, emailTextBox.Text, passwordTextBox.Text);

                Application.UserAppDataRegistry.SetValue("Server",  serverUrl);
                Application.UserAppDataRegistry.SetValue("Email", emailTextBox.Text);
                Application.UserAppDataRegistry.SetValue("Password", passwordTextBox.Text);

                this.Hide();
            }
            catch (AuthenticationException)
            {
                MessageBox.Show(this, "Invalid Login");
            }
        }
Beispiel #4
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     service = null;
     this.Hide();
 }