private void buttonRemove_Click(object sender, EventArgs e) { osalot.AssemblyObject o = Actions.SelectedItem as osalot.AssemblyObject; editing_macro.buttons.Remove(o); Actions.DataSource = null; Actions.DataSource = editing_macro.buttons; }
private void buttonAddAction_Click(object sender, EventArgs e) { Type t = AvailableActions.SelectedItem as Type; if (t != null) { object o = Activator.CreateInstance(t); IReflectorButton button = o as IReflectorButton; xperdex.core.osalot.AssemblyObject ao = new osalot.AssemblyObject(t, o); editing_macro.buttons.Add(ao); Actions.DataSource = null; Actions.DataSource = editing_macro.buttons; } }
private void buttonClone_Click(object sender, EventArgs e) { IReflectorButton button = core_common.clone_control.o as IReflectorButton; if (button != null) { object o = Activator.CreateInstance(core_common.clone_control.Type); //IReflectorButton newbutton = o as IReflectorButton; xperdex.core.osalot.AssemblyObject ao = new osalot.AssemblyObject(core_common.clone_control.Type, o); editing_macro.buttons.Add(ao); Actions.DataSource = null; Actions.DataSource = editing_macro.buttons; } }
private void buttonDn_Click(object sender, EventArgs e) { for (int i = 0; i < Actions.Items.Count - 1; i++) { if (Actions.GetSelected(i)) { osalot.AssemblyObject o = editing_macro.buttons[i]; editing_macro.buttons.RemoveAt(i); editing_macro.buttons.Insert(i + 1, o); Actions.DataSource = null; Actions.DataSource = editing_macro.buttons; Actions.SetSelected(i + 1, true); break; } } }
private void buttonEdit_Click(object sender, EventArgs e) { osalot.AssemblyObject o = Actions.SelectedItem as osalot.AssemblyObject; if (o == null) { MessageBox.Show("Bad element selection"); return; } IReflectorPersistance persis = o.o as IReflectorPersistance; if (persis != null) { persis.Properties(); } // content of the data source (the action item text for instance) may have changed... Actions.DataSource = null; Actions.DataSource = editing_macro.buttons; }
bool IReflectorPersistance.Load(XPathNavigator r) { if (String.Compare(r.Name, "Macro") == 0) { Object o; Assembly a = null; bool everokay = false; { // total violation of logic so far... but this is text... if (r.MoveToFirstAttribute()) { if (String.Compare(r.Name, "Text") == 0) { // ignore this, don't save it, would be redundant with button text... // Text = r.Value; } r.MoveToParent(); } } for (bool okay2 = r.MoveToFirstChild(); okay2; okay2 = r.MoveToNext()) { everokay = true; switch (r.Name) { case "Element": for (bool okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNextAttribute()) { switch (r.Name) { case "Assembly": a = osalot.LoadAssembly(r.Value); break; case "Type": Type t = osalot.findtype(a, r.Value); o = Activator.CreateInstance(t); IReflectorPersistance persis = o as IReflectorPersistance; r.MoveToParent(); // out of attributes... if (persis != null) { r.MoveToFirstChild(); if (persis.Load(r)) { // return from my move to child... r.MoveToParent(); } // return from my move to attribute } osalot.AssemblyObject ao = new osalot.AssemblyObject(t, o); buttons.Add(ao); //r.MoveToParent(); break; } } break; } } // return from my move to child.... if (everokay) { r.MoveToParent(); } return(true); } return(false); }