static public OperationResult<bool> InitializeFiresecDriver(bool isPing) { try { FSAgent = new FSAgent(ConnectionSettingsManager.FSAgentServerAddress); FiresecDriver = new FiresecDriver(); var result = FiresecDriver.Connect(FSAgent, isPing); return result; } catch (Exception e) { Logger.Error(e, "FiresecManager.InitializeFiresecDriver"); LoadingErrorManager.Add(e); return new OperationResult<bool>(e.Message); } }
private void OnCreateDrivers(object sender, RoutedEventArgs e) { var firesecDriver = new FiresecDriver(0, "localhost", 211, "adm", "", false); var driversConfiguration = ConfigurationCash.DriversConfiguration; try { driversConfiguration.Version = new ConfigurationVersion() { MajorVersion = 1, MinorVersion = 1 }; using (var memoryStream = new MemoryStream()) { var dataContractSerializer = new DataContractSerializer(typeof(DriversConfiguration)); dataContractSerializer.WriteObject(memoryStream, driversConfiguration); using (var fileStream = new FileStream("D:/DriversConfiguration.xml", FileMode.Create)) { fileStream.Write(memoryStream.GetBuffer(), 0, (int)memoryStream.Position); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }