예제 #1
0
        private NnReader()
        {
            try
            {
                string key = ConfigurationManager.AppSettings["dbkey"];
#if (DEBUG)
                string connstring = $"{ConfigurationManager.AppSettings["dbpath_d"]}{(string.IsNullOrEmpty(key) ? "" : "password="******";
#else
                string connstring = $"{ConfigurationManager.AppSettings["dbpath"]}{(string.IsNullOrEmpty(key) ? "" : "password="******";
#endif
                mConnection = new MySqlConnection(connstring);
                mConnection.Open();
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); NnMessage.ShowMessage("数据库错误!", true); }
        }
예제 #2
0
 public static void ShowMessage(string message, bool isError = false)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         if (isError)
         {
             if (mMessage == null)
             {
                 mMessage = new NnMessage();
             }
             mMessage._showMessage(message, isError);
             mMessage.Show();
             return;
         }
         NnMessage m = new NnMessage();
         m._showMessage(message, isError);
         m.Show();
     });
 }