Example #1
0
 public void LogifyCrashReport()
 {
     try
     {
         var         isEnabledReport = AppVariable.ReadBoolSetting(AppVariable.AutoSendReport);
         LogifyAlert client          = LogifyAlert.Instance;
         client.ApiKey                  = AppVariable.LogifyAPIKey;
         client.AppName                 = AppVariable.getAppName;
         client.AppVersion              = AppVariable.getAppVersion;
         client.OfflineReportsEnabled   = true;
         client.OfflineReportsCount     = 20;
         client.OfflineReportsDirectory = AppVariable.LogifyOfflinePath;
         client.SendOfflineReports();
         client.StartExceptionsHandling();
         if (isEnabledReport.Equals("True"))
         {
             client.StartExceptionsHandling();
         }
         else
         {
             client.StopExceptionsHandling();
         }
     }
     catch (Exception)
     {
     }
 }
Example #2
0
        private void ShowCredentialDialog()
        {
            try
            {
                var isLogin = AppVariable.ReadBoolSetting(AppVariable.CredentialLogin);
                if (isLogin)
                {
                    using (CredentialDialog dialog = new CredentialDialog())
                    {
                        dialog.WindowTitle     = "ورود به نرم افزار";
                        dialog.MainInstruction = "لطفا نام کاربری و رمز عبور خود را وارد کنید";
                        //dialog.Content = "";
                        dialog.ShowSaveCheckBox          = true;
                        dialog.ShowUIForSavedCredentials = true;
                        // The target is the key under which the credentials will be stored.
                        dialog.Target = "Mahdi72_MoalemYar_www.127.0.0.1.com";

                        try
                        {
                            while (isLogin)
                            {
                                if (dialog.ShowDialog(this))
                                {
                                    using (var db = new DataClass.myDbContext())
                                    {
                                        var usr = db.Users.Where(x => x.Username == dialog.Credentials.UserName && x.Password == dialog.Credentials.Password);
                                        if (usr.Any())
                                        {
                                            dialog.ConfirmCredentials(true);
                                            isLogin = false;
                                        }
                                        else
                                        {
                                            dialog.Content = "مشخصات اشتباه است دوباره امتحان کنید";
                                        }
                                    }
                                }
                                else
                                {
                                    Environment.Exit(0);
                                }
                            }
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #3
0
        private void LoadSettings()
        {
            try
            {
                var color = (Color)ColorConverter.ConvertFromString(AppVariable.ReadSetting(AppVariable.SkinCode));
                var brush = new SolidColorBrush(color);
                BorderBrush = brush;

                var hb_Menu = AppVariable.ReadBoolSetting(AppVariable.HamburgerMenu);
                MainWindow.main.tab.IconMode = !hb_Menu;

                var vCode = AppVariable.ReadSetting(AppVariable.VersionCode);
                if (!vCode.Equals(AppVariable.getAppVersion))
                {
                    AppVariable.InitializeSettings();
                }
                //Todo: Import Database to new Version
            }
            catch (Exception)
            {
            }
        }