Esempio n. 1
0
    void DatabaseSettingsSuccessDispatcher ()
    {
      // notify main process
      NotifyProcess (TCommandComm.Success);

      // update INI file
      var filePath = System.Environment.CurrentDirectory;
      var fileName = TNames.SettingsIniFileName;

      var data = new TDatabaseConnection (filePath, fileName);

      if (data.Request ()) {
        TDispatcher.Invoke (CloseSnackbarDispatcher);

        Model.SnackbarContent.SetMessage (Properties.Resource.RES_WELLCOME);
        TDispatcher.BeginInvoke (ShowSnackbarDispatcher, false);

        TDispatcher.Invoke (DatabaseValidateDispatcher);
      }

      else {
        var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD, (string) data.Result.ErrorContent)
        {
          Severity = TSeverity.Hight
        };

        TDispatcher.BeginInvoke (ShowErrorBoxDispatcher, errorMessage);
      }
    }
Esempio n. 2
0
    void SettingsValidatingDispatcher ()
    {
      var filePath = System.Environment.CurrentDirectory;
      var fileName = TNames.SettingsIniFileName;

      var data = new TDatabaseConnection (filePath, fileName);

      // success
      if (data.Request ()) {
        if (data.IsValidate) {
          SelectConnectionString (data);

          // notify shell database success
          var message = new TServicesMessage (TMessageAction.SettingsValidated, TypeInfo);
          message.Support.Select (TActionStatus.Success);
          message.Support.Argument.Types.Select (data.Authentication);

          PublishInvoke (message);
        }

        else {
          var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD_SETTINGS, Properties.Resource.RES_BAD_CONNECTION)
          {
            Severity = TSeverity.Hight
          };

          // notify shell database error
          NotifyDatabaseErrorHandler (errorMessage);
        }
      }

      else {
        var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD_SETTINGS, (string) data.Result.ErrorContent)
        {
          Severity = TSeverity.Hight
        };

        // notify shell database error
        NotifyDatabaseErrorHandler (errorMessage);
      }
    }