コード例 #1
0
        public static void Initialize()
        {
            WindowStateInfo.DefaultIcon = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\Icon\\DbSharp.ico"));
            AValue.ConfigData           = ConfigData.LoadConfigData();

            var l = AValue.ConfigData.RecentSchemaFiles.Where(el => String.IsNullOrEmpty(el.FilePath)).ToList();

            foreach (var item in l)
            {
                AValue.ConfigData.RecentSchemaFiles.Remove(item);
            }
            AValue.ConfigData.ChangeCultureInfo();

            if (String.IsNullOrEmpty(AValue.ConfigData.SchemaFilePath) == false)
            {
                try
                {
                    String xml = File.ReadAllText(AValue.ConfigData.SchemaFilePath);
                    AValue.LoadSchemaData(xml);
                }
                catch (FileNotFoundException)
                {
                    AValue.ConfigData.SchemaFilePath = "";
                }
            }
            if (AValue.SchemaData == null)
            {
                AValue.SchemaData = new SchemaData();
            }
            AValue.CreateErrorLogFolder();
            Application.Current.DispatcherUnhandledException += DispatcherUnhandledException;
        }
コード例 #2
0
        static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            AValue.AddErrorLog(e.Exception);
            var w = new MessageWindow(e.Exception.ToString());

            w.ShowDialog();
        }