/// <summary> /// Загрузить данные из XML-файла. /// </summary> /// <returns></returns> public void LoadFromXML() { if (File.Exists(FilePath)) { XmlSerializer deserializer = new XmlSerializer(typeof(VarXML)); TextReader textReader = new StreamReader(FilePath); VarXML obj = (VarXML)deserializer.Deserialize(textReader); textReader.Close(); WCFEndpointAddress = obj.WCFEndpointAddress; ServiceName = obj.ServiceName; TimerPeriod = obj.TimerPeriod; RebootComputer = obj.RebootComputer; FaultCountLimit = obj.FaultCountLimit; SQLAddress = obj.SQLAddress; SQLCleanPeriod = obj.SQLCleanPeriod; SQLActiveDays = obj.SQLActiveDays; SQLDateTimeFormat = obj.SQLDateTimeFormat; } }
public MainForm() { InitializeComponent(); varXml = new VarXML("Settings.xml"); DataClient = new DataServiceClient(); tmrCheckService = new ThreadTimer(); IsConnected = true; TryRebootCountLimit = 2; SQLCleanTrendTables = new Collection <string>(); SQLInited = false; SQLCleanTrendTableWorker = new BackgroundWorker(); SQLCleanTrendTableWorker.WorkerReportsProgress = true; SQLCleanTrendTableWorker.DoWork += SQLCleanTrendTableWorker_DoWork; SQLCleanTrendTableWorker.ProgressChanged += SQLCleanTrendTableWorker_ProgressChanged; SQLCleanTableAlls = new Collection <string>(); SQLCleanTableAllWorker = new BackgroundWorker(); SQLCleanTableAllWorker.WorkerReportsProgress = true; SQLCleanTableAllWorker.DoWork += SQLCleanTableAllWorker_DoWork; SQLCleanTableAllWorker.ProgressChanged += SQLCleanTableAllWorker_ProgressChanged; }