public virtual void LoadFromXml(XElement element) { var nameAttr = element.Attribute("name"); Name = nameAttr != null ? nameAttr.Value : ""; var items = from itm in element.Elements() where itm.Name == "logSourceGroup" || itm.Name == "logSource" select itm; foreach (var item in items) { if (item.Name == "logSourceGroup") { var logGroup = new LogSourceGroup(); logGroup.LoadFromXml(item); Items.Add(logGroup); } else if (item.Name == "logSource") { var logSource = new LogSource(); logSource.LoadFromXml(item); Items.Add(logSource); } } }
public void Update(LogSource source) { Name = source.Name; Server = source.Server; Database = source.Database; Table = source.Table; }
public void LoadSource(LogSource source) { btnConfirm.Text = Resources.Button_Update; _source = source; RefreshSource(); }
public LogSource GetSource() { var windowSource = new LogSource { Name = txtSourceName.Text, Server = (Server) ddlSourceServer.SelectedItem, Database = (string) ddlSourceDatabase.SelectedItem, Table = (string) ddlSourceTable.SelectedItem }; return windowSource; }
public void LoadSource(LogSource source) { _source = source; Text = source.Name; _conn = new DataConnection { Host = _source.Server.Host, Username = _source.Server.Username, Password = _source.Server.Password, Database = _source.Database, Table = _source.Table }; _conn.Open(); RefreshLogView(); _refreshTimer.Start(); }
private void DisplayLogSource(LogSource source) { if (_logPages.ContainsKey(source)) { logTabs.SelectedTab = _logPages[source]; } else { var logPage = new TabPage { Text = source.Name, Tag = source }; _logPages.Add(source, logPage); logTabs.TabPages.Add(logPage); } if (_logWindows.ContainsKey(source)) { _logWindows[source].Select(); } else { var logWindow = new LogWindow {MdiParent = this}; logWindow.LoadSource(source); logWindow.Closed += LogWindowClosed; _logWindows.Add(source, logWindow); logWindow.WindowState = FormWindowState.Maximized; logWindow.Show(); } logTabs.Visible = logTabs.TabCount > 0; }
private void RemoveLogSource(LogSource source) { // Remove the pages and windows from the list // first so there isn't a stack overflow due // to a "close window" event infinite loop if (_logPages.ContainsKey(source)) { var page = _logPages[source]; _logPages.Remove(source); logTabs.TabPages.Remove(page); } if (_logWindows.ContainsKey(source)) { var win = _logWindows[source]; _logWindows.Remove(source); win.Close(); } logTabs.Visible = logTabs.TabCount > 0; }