Beispiel #1
0
        private void btnOpenConnSettings_Click(object sender, EventArgs e)
        {
            var frm = new FrmConnection();

            frm.ShowDialog();
            GetRemoteServerConnectionState();
        }
Beispiel #2
0
        private async Task SyncData()
        {
            var result = Base.ShowDialog(MessageBoxButtons.YesNo, "Data Download", "Do you want to proceed with data download?");

            if (result == DialogResult.Yes)
            {
                if (GetRemoteServerConnectionState())
                {
                    var syncRepo = new SyncRepo();
                    var s        = await syncRepo.SyncAllData();

                    if (s == string.Empty)
                    {
                        Base.ShowSuccess("Success", "Data synchronization successful");
                    }
                    else
                    {
                        Base.ShowError("Error", s);
                    }
                }
                else
                {
                    Base.ShowError("Connection Failed", "Cannot connect to the remote server. Check your connection settings");
                    var frm = new FrmConnection();
                    frm.ShowDialog();
                }
            }
        }
Beispiel #3
0
        private async void FrmLogin_KeyDown(object sender, KeyEventArgs e)
        {
            //if (e.KeyCode == Keys.CapsLock)
            //{
            //    txtPassword
            //}

            // if (e.Modifiers == Keys.Control && e.KeyCode == Keys.Alt && e.KeyCode == Keys.D)
            if (e.Control && e.Alt && e.KeyCode == Keys.D)
            {
                var result = Base.ShowDialog(MessageBoxButtons.YesNo, "Data Download", "Do you want to proceed with data download?");
                if (result == DialogResult.Yes)
                {
                    if (Helper.CheckRemoteServerConnection())
                    {
                        Helper.MigrateAndSeedRemoteDb(); //seed remote if there's no data

                        var syncRepo = new SyncRepo();
                        var s        = await syncRepo.SyncAllData();

                        if (s == string.Empty)
                        {
                            Base.ShowSuccess("Success", "Data synchronization successful");
                        }
                        else
                        {
                            Base.ShowError("Error", s);
                        }
                    }
                    else
                    {
                        Base.ShowError("Connection Failed", "Cannot connect to the remote server. Check your connection settings");
                        var frm = new FrmConnection();
                        frm.BringToFront();
                        frm.ShowDialog();
                    }
                }
            }

            if (e.Control && e.Alt && e.KeyCode == Keys.O) //open connection string
            {
                var frm = new FrmConnection();
                frm.BringToFront();
                frm.ShowDialog();
                GetRemoteServerConnectionState();
            }
        }