コード例 #1
0
        /// <summary>
        /// Connects to FnLogServer, OpenMPSServer, ManastoneServer
        /// The license check and the retrieval of the OID Table will happen here
        /// Exits if connection is not possible
        /// </summary>
        private void InitClientConnection()
        {
            try
            {
                Config.GetInstance().Open();
                FnLog.SetInstance(new FnLog.FnLogInitPackage(
                                      "https://app.fearvel.de:9020/",
                                      System.Reflection.Assembly.GetExecutingAssembly().GetName().Name,
                                      Version.Parse(GetFileVersion()),
                                      FnLog.TelemetryType.LogLocalSendAll,
                                      "", ""), Config.GetInstance().GetConnector()
                                  );
                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT",
                                                 "FnLog INIT Complete");
                OpenMPSClient.SetInstance("https://app.fearvel.de:9040/");
                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT",
                                                 "OpenMPSClient set");
                ManastoneClient.SetInstance("https://app.fearvel.de:9060/", "5d1ae2a2-6ef3-4abd-86b8-905686dc6567");
                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT", "Manastone set");
                OpenMPSClient.GetInstance().CheckForCompatibleVersion();
                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT",
                                                 "Compatible VersionChecked");
                if (!ManastoneClient.GetInstance().CheckActivation())
                {
                    FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT",
                                                     "Activation process Started");
                    ActivateProgram();
                }

                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupLog, "openMPS Main Window INIT",
                                                 "Activation Update OID Starting");
            }
            catch (Exception e)
            {
                FnLog.GetInstance().AddToLogList(FnLog.LogType.StartupError, "Error on InitClientConnection of openMPS",
                                                 e.Message);
                FnLog.GetInstance().ProcessLogList();
                if (e is ManastoneException || e is ResultNullOrNotReceivedException)
                {
                    MessageBox.Show(
                        "Failed to connect to the Server. Check your internet connection and try again Later!");
                    Environment.Exit(0);
                }
                else if (e is SQLiteException)
                {
                    MessageBox.Show(
                        "SQLite Error\n Falls das Produkt noch nicht Aktiviert wurde löschen sie bitte alle *.db dateien\n" +
                        "Falls es bereits aktiviert wurde wenden Sie sich bitte an den Entwickeler");
                    Environment.Exit(0);
                }
                else
                {
                    MessageBox.Show("Ein unbekannter Fehler ist aufgetreten!!");
                    Environment.Exit(0);
                }
            }
        }