public void LoadSetting(XElement settingRoot) { timers.Clear(); foreach (XElement element in settingRoot.Elements("Timer")) { IObjectEditorType type = provider.Types.Where(t => t.GetType().AssemblyQualifiedName == element.Attribute("Class").Value).FirstOrDefault(); if (type != null) { ICalendarTimer timer = (ICalendarTimer)type.CreateObject(); timer.LoadSetting(element); timers.Add(timer); } } }
public void LoadSetting(XElement settingRoot) { commands.Clear(); foreach (XElement element in settingRoot.Elements("ScriptingCommand")) { IObjectEditorType type = provider.Types.Where(t => t.GetType().AssemblyQualifiedName == element.Attribute("Class").Value).FirstOrDefault(); if (type != null) { ScriptingCommand command = (ScriptingCommand)type.CreateObject(); command.LoadSetting(element); commands.Add(command); } } }
private void item_Click(object sender, EventArgs e) { IObjectEditorType type = (sender as ToolStripMenuItem).Tag as IObjectEditorType; IObjectEditorObject obj = type.CreateObject(); obj.Name = "未命名"; provider.Objects.Add(obj); ListViewItem item = new ListViewItem(obj.Name); item.Tag = obj; listViewCommands.Items.Add(item); item.Selected = true; }