private void ReadScreenParams(string cfgFileName) { XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(cfgFileName); } catch { return; } XmlNode nodeScreen = xmlDoc.SelectSingleNode("configuration/screens/screen"); while (nodeScreen != null) { KanbanScreen screen = new KanbanScreen(); screen.DeviceName = nodeScreen.Attributes["DeviceName"].Value; try { screen.SysLogID = Int64.Parse(nodeScreen.Attributes["SysLogID"].Value); } catch { screen.SysLogID = 0; } try { screen.Show = bool.Parse(nodeScreen.Attributes["Showed"].Value); } catch { screen.Show = false; } screens.Add(screen); nodeScreen = nodeScreen.NextSibling; } }
public KanbanScreens() { cfgFileName = string.Format("{0}.xml", Assembly.GetCallingAssembly().Location); if (File.Exists(cfgFileName)) { ReadScreenParams(cfgFileName); } Screen[] sc = Screen.AllScreens; bool finded = false; for (int i = 0; i < sc.Length; i++) { finded = false; foreach (KanbanScreen screen in screens) { if (screen.ToString() == sc[i].DeviceName) { screen.ScreenIndex = i; screen.Detected = true; screen.Bounds = sc[i].Bounds; finded = true; break; } } if (!finded) { KanbanScreen screen = new KanbanScreen() { ScreenIndex = i, DeviceName = sc[i].DeviceName, Detected = true, Bounds = sc[i].Bounds, }; screens.Add(screen); } } }
public frmMain(KanbanScreen screen) : this() { _screen = screen; }