コード例 #1
0
ファイル: FiresecDriver.cs プロジェクト: saeednazari/Rubezh
		public OperationResult<bool> Connect(FSAgent fsAgent, bool isPing)
		{
			try
			{
				FiresecSerializedClient = new FiresecSerializedClient();
				FiresecSerializedClient.FSAgent = fsAgent;
				FiresecSerializedClient.SubscribeFsAgentEvents();

                ConfigurationConverter = new ConfigurationConverter(FiresecSerializedClient);
				var result = ConfigurationConverter.ConvertMetadataFromFiresec();
                if (!result.HasError)
                {
                    ConfigurationCash.DriversConfiguration = result.Result;
                    return new OperationResult<bool>() { Result = true };
                }
                else
                {
					return new OperationResult<bool>(result.Error);
                }
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecDriver.Synchronyze");
                LoadingErrorManager.Add(e);
                return new OperationResult<bool>(e.Message);
			}
		}
コード例 #2
0
		public FiresecDriver(int lastJournalNo, string FS_Address, int FS_Port, string FS_Login, string FS_Password, bool isPing)
		{
			LoadingErrors = new StringBuilder();
			try
			{
				FiresecSerializedClient = new FiresecSerializedClient();
				FiresecSerializedClient.Connect(FS_Address, FS_Port, FS_Login, FS_Password, isPing);
				ConfigurationConverter = new ConfigurationConverter()
				{
					FiresecSerializedClient = FiresecSerializedClient
				};
				ConfigurationConverter.ConvertMetadataFromFiresec();
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecDriver.Synchronyze");
				FiresecDriver.LoadingErrors.Append(e.Message);
			}
		}