private void LoadFile(string fname) { if (!File.Exists(fname)) { return; } XDocument file; using (var reader = File.OpenText(fname)) { file = XDocument.Load(reader); } modelsTabSwitch.TabPages.Clear(); FRAMMapper.Clear(); __JoyInfos.Clear(); __JoyInfos.AddRange(JoystickConfig.LoadFromXML(file)); __Settings = ProjectSettings.LoadFromXML(file) ?? new ProjectSettings(); if (file.Root != null) { var xmodels = file.Root.Element("Models"); if (xmodels != null) { foreach (var xElement in xmodels.Elements()) { var panel = new DesignPanel(); panel.Deserialize(xElement); AddModelPanel(panel); } foreach (var panel in Panels) { panel.Link(); } } } CurrentFileName = fname; AddFileToLastFiles(fname); SaveLastList(); SetFileState(); SetSavedState(); UpdateJoystics(); }