/// <summary> /// This member overrides PropertyBag.OnGetValue. /// </summary> protected override void OnGetValue(PropertySpecEventArgs e) { e.Value = propValues[e.Property.Name]; base.OnGetValue(e); }
/// <summary> /// This member overrides PropertyBag.OnSetValue. /// </summary> protected override void OnSetValue(PropertySpecEventArgs e) { propValues[e.Property.Name] = e.Value; base.OnSetValue(e); }
private void propbag_GetValue(object sender, PropertySpecEventArgs e) { if (this.proptype == 0) { if (e.Property.Name == "Relative Path") e.Value = file.RelativePath; else if (e.Property.Name == "Friendly Name") e.Value = file.SimpleName; else if (e.Property.Name == "Treat as Text") e.Value = file.isText; } else if (this.proptype == 1) { switch (e.Property.Name) { case "Project Name": e.Value = proj.ProjectName; break; case "Project Path": e.Value = proj.ProjectPath; break; case "Executable Path": e.Value = proj.DebugExe; break; case "Debug Password": e.Value = proj.DebugPasswd; break; case "Debug Port": e.Value = proj.DebugPort; break; case "Debug Parameters": e.Value = proj.DebugParams; break; case "Enable Debugging": e.Value = proj.DebugEnabled; break; case "Project Type": e.Value = GetTypeEx(proj.ProjectType); break; case "Enable 'OneClick' Debugging": e.Value = proj.DebugAutoInsert; break; case "Debug Startup Script": e.Value = proj.DebugMainCs; break; } } }
private void propbag_SetValue(object sender, PropertySpecEventArgs e) { if (this.proptype == 0) { if (e.Property.Name == "Relative Path") file.RelativePath = e.Value.ToString(); else if (e.Property.Name == "Friendly Name") file.SimpleName = e.Value.ToString(); else if (e.Property.Name == "Treat as Text") file.isText = Convert.ToBoolean(e.Value); } else if (this.proptype == 1) { switch (e.Property.Name) { case "Project Name": proj.ProjectName = e.Value.ToString(); break; case "Debug Parameters": this.proj.DebugParams = e.Value.ToString(); break; case "Project Path": if (!Directory.Exists(e.Value.ToString())) { MessageBox.Show(this, "Invalid path.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } proj.ProjectPath = e.Value.ToString(); break; case "Executable Path": if (e.Value.ToString() == "") { proj.DebugExe = e.Value.ToString(); } else if (!File.Exists(e.Value.ToString())) { MessageBox.Show(this, "Invalid executable.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } proj.DebugExe = e.Value.ToString(); break; case "Debug Password": proj.DebugPasswd = e.Value.ToString(); break; case "Debug Port": if (Convert.ToInt32(e.Value) > 65534 || Convert.ToInt32(e.Value) < 10) { MessageBox.Show(this, "Invalid port.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } proj.DebugPort = Convert.ToInt32(e.Value); break; case "Enable Debugging": proj.DebugEnabled = Convert.ToBoolean(e.Value); break; case "Debug Startup Script": proj.DebugMainCs = e.Value.ToString(); break; case "Enable 'OneClick' Debugging": proj.DebugAutoInsert = Convert.ToBoolean(e.Value); break; case "Project Type": if (e.Value.ToString() == "") e.Value = ((g.Config.ActivationHasTGE) ? "TGE" : ((g.Config.ActivationHasTSE) ? "TSE" : ((g.Config.ActivationHasT2D) ? "T2D/TGB" : "TGE" ))); // Verify the project type is licensed if (e.Value.ToString() == "TGE" && g.Config.ActivationHasTGE == false) { MessageBox.Show(this, "Error: You are not licensed to open TGE projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (e.Value.ToString() == "TSE" && g.Config.ActivationHasTSE == false) { MessageBox.Show(this, "Error: You are not licensed to open TSE projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (e.Value.ToString() == "T2D/TGB" && g.Config.ActivationHasT2D == false) { MessageBox.Show(this, "Error: You are not licensed to open T2D projects.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } proj.ProjectType = GetTypeEx(e.Value.ToString()); g.Main.LoadAutoComplete(); g.Main.InitPublicList(); break; } } g.Main.InitProject(); }
public override void SetValue(object component, object value) { // Have the property bag raise an event to set the current value // of the property. PropertySpecEventArgs e = new PropertySpecEventArgs(item, value); bag.OnSetValue(e); }
public override object GetValue(object component) { // Have the property bag raise an event to get the current value // of the property. PropertySpecEventArgs e = new PropertySpecEventArgs(item, null); bag.OnGetValue(e); return e.Value; }
/// <summary> /// Raises the SetValue event. /// </summary> /// <param name="e">A PropertySpecEventArgs that contains the event data.</param> protected virtual void OnSetValue(PropertySpecEventArgs e) { if(SetValue != null) SetValue(this, e); }