| 0: | using System; | |
| 1: | using System.Collections; | |
| 2: | using System.ComponentModel; | |
| 3: | using System.Drawing; | |
| 4: | using System.Data; | |
| 5: | using System.Windows.Forms; | |
| 6: | ||
| 7: | using SharpDevelop.Tool.Data; | |
| 8: | using SharpDevelop.Internal.Project; | |
| 9: | ||
| 10: | namespace SharpDevelop.Gui.Dialogs { | |
| 11: | /// <summary> | |
| 12: | /// Summary description for UserControl1. | |
| 13: | /// </summary> | |
| 14: | public class CombineStartupPanel : AbstractOptionPanel | |
| 15: | { | |
| 16: | private System.Windows.Forms.RadioButton radioButton1; | |
| 17: | private System.Windows.Forms.RadioButton radioButton2; | |
| 18: | private System.Windows.Forms.Label label1; | |
| 19: | private System.Windows.Forms.ColumnHeader columnHeader1; | |
| 20: | private System.Windows.Forms.ColumnHeader columnHeader2; | |
| 21: | private System.Windows.Forms.ComboBox singlecomboBox; | |
| 22: | private System.Windows.Forms.ComboBox actioncomboBox; | |
| 23: | private System.Windows.Forms.ListView entrylistView; | |
| 24: | private System.Windows.Forms.Button moveupButton; | |
| 25: | private System.Windows.Forms.Button movedownButton; | |
| 26: | /// <summary> | |
| 27: | /// Required designer variable. | |
| 28: | /// </summary> | |
| 29: | private System.ComponentModel.Container components = null; | |
| 30: | ||
| 31: | Combine combine; | |
| 32: | ||
| 33: | ||
| 34: | ||
| 35: | public override void Accept() | |
| 36: | { | |
| 37: | // write back singlestartup project | |
| 38: | combine.SingleStartProjectName = singlecomboBox.Text; | |
| 39: | combine.SingleStartupProject = radioButton1.Checked; | |
| 40: | ||
| 41: | // write back new combine execute definitions | |
| 42: | combine.CombineExecuteDefinitions.Clear(); | |
| 43: | foreach (ListViewItem item in entrylistView.Items) { | |
| 44: | EntryExecuteType type = EntryExecuteType.None; | |
| 45: | if (item.SubItems[1].Text == Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.Execute")) { | |
| 46: | type = EntryExecuteType.Execute; | |
| 47: | } | |
| 48: | combine.CombineExecuteDefinitions.Add(new CombineExecuteDefinition( | |
| 49: | combine.GetEntry(item.Text), | |
| 50: | type | |
| 51: | )); | |
| 52: | } | |
| 53: | } | |
| 54: | ||
| 55: | public CombineStartupPanel(Combine combine) : base(Resource.GetString("Dialog.Options.CombineOptions.Startup.PanelName")) | |
| 56: | { | |
| 57: | this.combine = combine; | |
| 58: | ||
| 59: | // This call is required by the Windows.Forms Form Designer. | |
| 60: | InitializeComponent(); | |
| 61: | ||
| 62: | radioButton1.Checked = combine.SingleStartupProject; | |
| 63: | radioButton2.Checked = !combine.SingleStartupProject; | |
| 64: | ||
| 65: | foreach (CombineEntry entry in combine.Entries) | |
| 66: | singlecomboBox.Items.Add(entry.Name); | |
| 67: | ||
| 68: | singlecomboBox.SelectedIndex = combine.GetEntryNumber(combine.SingleStartProjectName); | |
| 69: | ||
| 70: | radioButton1.CheckedChanged += new EventHandler(CheckedChanged); | |
| 71: | ||
| 72: | entrylistView.SelectedIndexChanged += new EventHandler(SelectedEntryChanged); | |
| 73: | actioncomboBox.SelectedIndexChanged += new EventHandler(OptionsChanged); | |
| 74: | foreach (CombineExecuteDefinition edef in combine.CombineExecuteDefinitions) { | |
| 75: | entrylistView.Items.Add(new ListViewItem(new string[] { | |
| 76: | edef.Entry.Name, | |
| 77: | edef.Type == EntryExecuteType.None ? Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.None") : Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.Execute") | |
| 78: | })); | |
| 79: | } | |
| 80: | ||
| 81: | ||
| 82: | CheckedChanged(null, null); | |
| 83: | } | |
| 84: | ||
| 85: | void CheckedChanged(object sender, EventArgs e) | |
| 86: | { | |
| 87: | entrylistView.Enabled = actioncomboBox.Enabled = radioButton2.Checked; | |
| 88: | singlecomboBox.Enabled = radioButton1.Checked; | |
| 89: | } | |
| 90: | void OptionsChanged(object sender, EventArgs e) | |
| 91: | { | |
| 92: | if (entrylistView.SelectedItems == null || | |
| 93: | entrylistView.SelectedItems.Count == 0) | |
| 94: | return; | |
| 95: | ListViewItem item = entrylistView.SelectedItems[0]; | |
| 96: | item.SubItems[1].Text = actioncomboBox.SelectedItem.ToString(); | |
| 97: | ||
| 98: | } | |
| 99: | void SelectedEntryChanged(object sender, EventArgs e) | |
| 100: | { | |
| 101: | if (entrylistView.SelectedItems == null || | |
| 102: | entrylistView.SelectedItems.Count == 0) | |
| 103: | return; | |
| 104: | ListViewItem item = entrylistView.SelectedItems[0]; | |
| 105: | string txt = item.SubItems[1].Text; | |
| 106: | actioncomboBox.Items.Clear(); | |
| 107: | actioncomboBox.Items.Add(Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.None")); | |
| 108: | actioncomboBox.Items.Add(Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.Execute")); | |
| 109: | ||
| 110: | if (txt == Resource.GetString("Dialog.Options.CombineOptions.Startup.Action.None")) { | |
| 111: | actioncomboBox.SelectedIndex = 0; | |
| 112: | } else { | |
| 113: | actioncomboBox.SelectedIndex = 1; | |
| 114: | } | |
| 115: | ||
| 116: | ||
| 117: | ||
| 118: | } | |
| 119: | ||
| 120: | /// <summary> | |
| 121: | /// Clean up any resources being used. | |
| 122: | /// </summary> | |
| 123: | protected override void Dispose(bool disposing) | |
| 124: | { | |
| 125: | if (disposing) { | |
| 126: | if (components != null){ | |
| 127: | components.Dispose(); | |
| 128: | } | |
| 129: | } | |
| 130: | base.Dispose(disposing); | |
| 131: | } | |
| 132: | ||
| 133: | #region Component Designer generated code | |
| 134: | /// <summary> | |
| 135: | /// Required method for Designer support - do not modify | |
| 136: | /// the contents of this method with the code editor. | |
| 137: | /// </summary> | |
| 138: | private void InitializeComponent() | |
| 139: | { | |
| 140: | this.radioButton1 = new System.Windows.Forms.RadioButton(); | |
| 141: | this.actioncomboBox = new System.Windows.Forms.ComboBox(); | |
| 142: | this.radioButton2 = new System.Windows.Forms.RadioButton(); | |
| 143: | this.entrylistView = new System.Windows.Forms.ListView(); | |
| 144: | this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); | |
| 145: | this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); | |
| 146: | this.movedownButton = new System.Windows.Forms.Button(); | |
| 147: | this.moveupButton = new System.Windows.Forms.Button(); | |
| 148: | this.singlecomboBox = new System.Windows.Forms.ComboBox(); | |
| 149: | this.label1 = new System.Windows.Forms.Label(); | |
| 150: | this.SuspendLayout(); | |
| 151: | // | |
| 152: | // radioButton1 | |
| 153: | // | |
| 154: | this.radioButton1.Location = new System.Drawing.Point(8, 8); | |
| 155: | this.radioButton1.Name = "radioButton1"; | |
| 156: | this.radioButton1.Size = new System.Drawing.Size(264, 24); | |
| 157: | this.radioButton1.TabIndex = 0; | |
| 158: | this.radioButton1.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.SingleStartupRadioButton"); | |
| 159: | ||
| 160: | // | |
| 161: | // actioncomboBox | |
| 162: | // | |
| 163: | this.actioncomboBox.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 164: | this.actioncomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; | |
| 165: | this.actioncomboBox.DropDownWidth = 168; | |
| 166: | this.actioncomboBox.Location = new System.Drawing.Point(312, 104); | |
| 167: | this.actioncomboBox.Name = "actioncomboBox"; | |
| 168: | this.actioncomboBox.Size = new System.Drawing.Size(168, 21); | |
| 169: | this.actioncomboBox.TabIndex = 5; | |
| 170: | // | |
| 171: | // radioButton2 | |
| 172: | // | |
| 173: | this.radioButton2.Location = new System.Drawing.Point(8, 64); | |
| 174: | this.radioButton2.Name = "radioButton2"; | |
| 175: | this.radioButton2.Size = new System.Drawing.Size(264, 24); | |
| 176: | this.radioButton2.TabIndex = 1; | |
| 177: | this.radioButton2.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.MultipleStartupRadioButton"); | |
| 178: | ||
| 179: | // | |
| 180: | // entrylistView | |
| 181: | // | |
| 182: | this.entrylistView.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |
| 183: | | System.Windows.Forms.AnchorStyles.Left) | |
| 184: | | System.Windows.Forms.AnchorStyles.Right); | |
| 185: | this.entrylistView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { | |
| 186: | this.columnHeader1, | |
| 187: | this.columnHeader2}); | |
| 188: | this.entrylistView.FullRowSelect = true; | |
| 189: | this.entrylistView.GridLines = true; | |
| 190: | this.entrylistView.HideSelection = false; | |
| 191: | this.entrylistView.Location = new System.Drawing.Point(8, 88); | |
| 192: | this.entrylistView.MultiSelect = false; | |
| 193: | this.entrylistView.Name = "entrylistView"; | |
| 194: | this.entrylistView.Size = new System.Drawing.Size(296, 240); | |
| 195: | this.entrylistView.TabIndex = 6; | |
| 196: | this.entrylistView.View = System.Windows.Forms.View.Details; | |
| 197: | // | |
| 198: | // columnHeader1 | |
| 199: | // | |
| 200: | this.columnHeader1.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.EntryColumnHeader"); | |
| 201: | this.columnHeader1.Width = 185; | |
| 202: | ||
| 203: | // | |
| 204: | // columnHeader2 | |
| 205: | // | |
| 206: | this.columnHeader2.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.ActionColumnHeader"); | |
| 207: | this.columnHeader2.Width = 100; | |
| 208: | ||
| 209: | // | |
| 210: | // movedownButton | |
| 211: | // | |
| 212: | this.movedownButton.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 213: | this.movedownButton.Location = new System.Drawing.Point(312, 168); | |
| 214: | this.movedownButton.Name = "movedownButton"; | |
| 215: | this.movedownButton.TabIndex = 8; | |
| 216: | this.movedownButton.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.MoveDownButton"); | |
| 217: | ||
| 218: | // | |
| 219: | // moveupButton | |
| 220: | // | |
| 221: | this.moveupButton.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 222: | this.moveupButton.Location = new System.Drawing.Point(312, 136); | |
| 223: | this.moveupButton.Name = "moveupButton"; | |
| 224: | this.moveupButton.TabIndex = 7; | |
| 225: | this.moveupButton.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.MoveUpButton"); | |
| 226: | ||
| 227: | // | |
| 228: | // singlecomboBox | |
| 229: | // | |
| 230: | this.singlecomboBox.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
| 231: | | System.Windows.Forms.AnchorStyles.Right); | |
| 232: | this.singlecomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; | |
| 233: | this.singlecomboBox.DropDownWidth = 264; | |
| 234: | this.singlecomboBox.Location = new System.Drawing.Point(8, 32); | |
| 235: | this.singlecomboBox.Name = "singlecomboBox"; | |
| 236: | this.singlecomboBox.Size = new System.Drawing.Size(304, 21); | |
| 237: | this.singlecomboBox.TabIndex = 2; | |
| 238: | // | |
| 239: | // label1 | |
| 240: | // | |
| 241: | this.label1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 242: | this.label1.Location = new System.Drawing.Point(312, 88); | |
| 243: | this.label1.Name = "label1"; | |
| 244: | this.label1.Size = new System.Drawing.Size(56, 16); | |
| 245: | this.label1.TabIndex = 4; | |
| 246: | this.label1.Text = Resource.GetString("Dialog.Options.CombineOptions.Startup.ActionLabel"); | |
| 247: | ||
| 248: | // | |
| 249: | // UserControl1 | |
| 250: | // | |
| 251: | this.Controls.AddRange(new System.Windows.Forms.Control[] { | |
| 252: | this.movedownButton, | |
| 253: | this.moveupButton, | |
| 254: | this.entrylistView, | |
| 255: | this.actioncomboBox, | |
| 256: | this.label1, | |
| 257: | this.singlecomboBox, | |
| 258: | this.radioButton2, | |
| 259: | this.radioButton1}); | |
| 260: | this.Name = "UserControl1"; | |
| 261: | this.Size = new System.Drawing.Size(488, 336); | |
| 262: | this.ResumeLayout(false); | |
| 263: | ||
| 264: | } | |
| 265: | #endregion | |
| 266: | } | |
| 267: | } | |
| 268: |
This page was automatically generated by SharpDevelop.