Exemple #1
0
 private void ElementClicked(object sender, RoutedEventArgs e)
 {
     try
     {
         Process.Start((string)(((Button)sender).Tag));
     }
     catch (Win32Exception ex)
     {
         ErrorHandler.Log(ex);
         ErrorWindow ew = new ErrorWindow();
         ew.ExceptionReason = ex;
         ew.ExceptionString = ex.ToString() + $"\r\n{(string)(((Button)sender).Tag)} can't be opened by default application(s)";
         ew.ShowDialog();
     }
     catch (Exception ex)
     {
         ErrorHandler.Log(ex);
         ErrorWindow ew = new ErrorWindow();
         ew.ExceptionReason = ex;
         ew.ShowDialog();
     }
 }
Exemple #2
0
 private void Mi_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Process.Start((string)((MenuItem)sender).Tag);
     }
     catch (Win32Exception ex)
     {
         ErrorHandler.Log(ex);
         ErrorWindow ew = new ErrorWindow();
         ew.ExceptionReason = ex;
         ew.ExceptionString = ex.ToString() + $"\r\n{(string)(((MenuItem)sender).Tag)} can't be opened by default application(s)";//$"File {(string)(((Button)sender).Tag)} can't be opened by default application(s).\r\nIf this issue appears too often, please add issue to github.";
         ew.ShowDialog();
     }
     catch (Exception ex)
     {
         ErrorHandler.Log(ex);
         ErrorWindow ew = new ErrorWindow();
         ew.ExceptionReason = ex;
         ew.ShowDialog();
     }
 }
Exemple #3
0
        public static ConfigClass GetConfig()
        {
            try
            {
                string json_out = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Tiels\\config.json");
                if (json_out != "")
                {
                    ConfigClass config = JsonConvert.DeserializeObject <ConfigClass>(json_out);

                    if (config == null)
                    {
                        ErrorHandler.Error();
                    }

                    return(config);
                }
                else
                {
                    ErrorHandler.Error();
                    return(null);
                }
            }
            catch (FileNotFoundException fex)
            {
                ErrorHandler.Error();
                return(null);
            }
            catch (Exception ex)
            {
                File.AppendAllText(config_path + "\\Error.log", "\r\n[Error: " + DateTime.Now + "] " + ex.ToString());
                ErrorWindow ew = new ErrorWindow();
                ew.ExceptionReason = ex;
                ew.ShowDialog();
                return(null);
            }
        }