Ejemplo n.º 1
0
        private async void LogIn_Click(object sender, RoutedEventArgs e)
        {
            _username = Username.Text;
            _password = Password.Password;

            if ((!string.IsNullOrEmpty(_username)) && (!string.IsNullOrEmpty(_password)))
            {
                if (await _adminManager.LogIn(_username, _password))
                {
                    MetroMessageBoxHelper.ShowBox("LOG IN SUCCESS", string.Format("Welcome {0}. You have logged yourself successfully.", _username));
                    new Admin().Show();
                    this.Close();
                }
                else
                {
                    ErrorText.Text = "Admin with specified creditials does not exist. :(";
                    ShowError();
                }
            }
            else
            {
                ErrorText.Text = "You must enter username and password";
                ShowError();
            }
        }
Ejemplo n.º 2
0
 public bool ChangePassword(AndroidToolkitDB db, int id, string newPassword, string oldPassword)
 {
     try
     {
         AndroidToolkit.Admin editAdmin = _db.Admins.FirstOrDefault(a => a.ID == id);
         if (editAdmin != null && editAdmin.Password == oldPassword)
         {
             editAdmin.Password = newPassword;
             _db.Admins.AddOrUpdate(editAdmin);
             _db.SaveChanges();
             return(true);
         }
         //if (editAdmin != null)
         //{
         //    editAdmin.Password = newPassword;
         //    db.Admins.Attach(editAdmin);
         //    db.Entry(editAdmin).State = EntityState.Modified;
         //    db.SaveChanges();
         //    return true;
         //}
         return(false);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("ERROR", ex.ToString(), 400, 200);
         return(false);
     }
 }
Ejemplo n.º 3
0
 private void ReportBugTile_Click(object sender, RoutedEventArgs e)
 {
     if (ConnectionChecker.IsConnectedToInternet)
     {
         new ReportBugInterop().ShowDialog();
     }
     else
     {
         MetroMessageBoxHelper.ShowBox("ERROR", "You are not connected to internet", 400, 150);
     }
 }
Ejemplo n.º 4
0
 private void HelpTextsGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         _helpText = (HelpText)HelpTextsGrid.SelectedItem;
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("ERROR", ex.ToString());
     }
 }
Ejemplo n.º 5
0
 public async Task <bool> LogIn(string username, string password)
 {
     try
     {
         return(await LogInSuccess(username, password));
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
     }
     return(false);
 }
Ejemplo n.º 6
0
        private void UserControlWithMessage_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            IsVisibleChanged -= UserControlWithMessage_IsVisibleChanged;

            if (DataContext is ITabWithMessage tab)
            {
                Task.Factory.StartNew(async() => await MetroMessageBoxHelper.ShowDialog(tab.Message),
                                      CancellationToken.None,
                                      TaskCreationOptions.None,
                                      TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
Ejemplo n.º 7
0
 void downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         DownloadProgress.Visibility = Visibility.Collapsed;
         Process.Start("UniversalAdbDriverSetup.msi");
         this.ShowMessageAsync("DRIVERS DOWNLOADED", null);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("ERROR", ex.ToString(), 400, 200);
     }
 }
Ejemplo n.º 8
0
 public bool Edit(AndroidToolkitDB _db)
 {
     try
     {
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
Ejemplo n.º 9
0
        private async void ShowErrorLog_OnClick(object sender, RoutedEventArgs e)
        {
            string errorLog = await ErrorLog();

            if (errorLog.Length != 0)
            {
                MetroMessageBoxHelper.ShowBox("ERROR LOG", errorLog, 500, 250);
            }
            else
            {
                MetroMessageBoxHelper.ShowBox("EXCELLENT", "This app doesn't have errors. :)", 250, 125);
            }
        }
Ejemplo n.º 10
0
 public bool Delete(AndroidToolkitDB _db, Device device)
 {
     try
     {
         _db.Devices.Remove(device);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
Ejemplo n.º 11
0
 public bool CreateAdmin(AndroidToolkitDB db, string name, string username, string password)
 {
     try
     {
         _db.Admins.Add(new AndroidToolkit.Admin()
         {
             Name = name, Username = username, Password = password
         });
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
Ejemplo n.º 12
0
 public bool CreateDevice(AndroidToolkitDB _db, string name, string cwm, string cwmTouch, string twrp, string deviceImg = null)
 {
     try
     {
         _device = new Device()
         {
             Name             = name,
             CWMRecovery      = cwm,
             CWMTouchRecovery = cwmTouch,
             TWRPRecovery     = twrp,
             DeviceImg        = deviceImg
         };
         _db.Devices.Add(_device);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         MetroMessageBoxHelper.ShowBox("Error", ex.ToString(), 400, 200);
         return(false);
     }
 }
Ejemplo n.º 13
0
        public void showWarning(string text, string type)
        {
            MetroMessageBoxHelper helper = new MetroMessageBoxHelper();

            helper.showWarning(this, text, type);
        }
 private async void Flash_Click(object sender, RoutedEventArgs e)
 {
     _currentRecovery = (string)FlashRecoveriesComboBox.SelectedItem;
     if (!string.IsNullOrEmpty(_currentRecovery))
     {
         if (_currentRecovery == "CWM")
         {
             bool isConn = ConnectionChecker.IsConnectedToInternet;
             if (isConn == true)
             {
                 WebClient cwmDownloader = new WebClient();
                 cwmDownloader.DownloadProgressChanged += cwmDownloader_DownloadProgressChanged;
                 cwmDownloader.DownloadFileCompleted   += cwmDownloader_DownloadFileCompleted;
                 cwmDownloader.DownloadFileAsync(new Uri(_device.CWMRecovery), "recovery.img");
                 RunFlyout(2);
             }
             else
             {
                 MetroMessageBoxHelper.ShowBox("Error", "It seems like you are not connected to Internet.\n Contact your system admin or try again", 225, 150);
             }
         }
         else if (_currentRecovery == "CWM Touch")
         {
             bool isConn = ConnectionChecker.IsConnectedToInternet;
             if (isConn == true)
             {
                 WebClient cwmTouchDownloader = new WebClient();
                 cwmTouchDownloader.DownloadProgressChanged += cwmtouchDownloader_DownloadProgressChanged;
                 cwmTouchDownloader.DownloadFileCompleted   += cwmtouchDownloader_DownloadFileCompleted;
                 cwmTouchDownloader.DownloadFileAsync(new Uri(_device.CWMTouchRecovery), "recovery.img");
                 RunFlyout(2);
             }
             else
             {
                 MetroMessageBoxHelper.ShowBox("Error", "It seems like you are not connected to Internet.\n Contact your system admin or try again", 225, 150);
             }
         }
         else if (_currentRecovery == "TWRP")
         {
             bool isConn = ConnectionChecker.IsConnectedToInternet;
             if (isConn == true)
             {
                 WebClient twrpDownloader = new WebClient();
                 twrpDownloader.DownloadProgressChanged += twrpDownloader_DownloadProgressChanged;
                 twrpDownloader.DownloadFileCompleted   += twrpDownloader_DownloadFileCompleted;
                 twrpDownloader.DownloadFileAsync(new Uri(_device.TWRPRecovery), "recovery.img");
                 RunFlyout(2);
             }
             else
             {
                 MetroMessageBoxHelper.ShowBox("Error", "It seems like you are not connected to Internet.\n Contact your system admin or try again", 225, 150);
             }
         }
         else
         {
             MessageBox.Show("Unknown error");
         }
     }
     else
     {
         await this.ShowMessageAsync("YOU MUST SELECT RECOVERY", null);
     }
 }