Changeset 4860 for branches/VRP/HeuristicLab.Problems.VehicleRouting.Views
- Timestamp:
- 11/19/10 15:43:21 (14 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj
r4374 r4860 125 125 <DependentUpon>SingleDepotVRPView.cs</DependentUpon> 126 126 </Compile> 127 <Compile Include="VRPImportDialog.cs"> 128 <SubType>Form</SubType> 129 </Compile> 130 <Compile Include="VRPImportDialog.Designer.cs"> 131 <DependentUpon>VRPImportDialog.cs</DependentUpon> 132 </Compile> 127 133 <Compile Include="VRPProblemInstanceView.cs"> 128 134 <SubType>UserControl</SubType> -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.Designer.cs
r4362 r4860 25 25 private void InitializeComponent() { 26 26 this.importButton = new System.Windows.Forms.Button(); 27 this.importButton2 = new System.Windows.Forms.Button();28 this.importButton3 = new System.Windows.Forms.Button();29 27 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 30 28 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); … … 38 36 // importButton 39 37 // 38 this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 39 | System.Windows.Forms.AnchorStyles.Right))); 40 40 this.importButton.Location = new System.Drawing.Point(0, 55); 41 41 this.importButton.Name = "importButton"; 42 this.importButton.Size = new System.Drawing.Size( 139, 23);42 this.importButton.Size = new System.Drawing.Size(490, 23); 43 43 this.importButton.TabIndex = 5; 44 this.importButton.Text = "Import from Solomon";44 this.importButton.Text = "Import"; 45 45 this.importButton.UseVisualStyleBackColor = true; 46 46 this.importButton.Click += new System.EventHandler(this.importButton_Click); 47 //48 // importButton249 //50 this.importButton2.Location = new System.Drawing.Point(145, 55);51 this.importButton2.Name = "importButton2";52 this.importButton2.Size = new System.Drawing.Size(126, 23);53 this.importButton2.TabIndex = 7;54 this.importButton2.Text = "Import from TSPLib";55 this.importButton2.UseVisualStyleBackColor = true;56 this.importButton2.Click += new System.EventHandler(this.importButton2_Click);57 //58 // importButton359 //60 this.importButton3.Location = new System.Drawing.Point(277, 55);61 this.importButton3.Name = "importButton3";62 this.importButton3.Size = new System.Drawing.Size(131, 23);63 this.importButton3.TabIndex = 8;64 this.importButton3.Text = "Import from ORLib";65 this.importButton3.UseVisualStyleBackColor = true;66 this.importButton3.Click += new System.EventHandler(this.importButton3_Click);67 47 // 68 48 // parameterCollectionView … … 83 63 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 84 64 this.Controls.Add(this.parameterCollectionView); 85 this.Controls.Add(this.importButton3);86 this.Controls.Add(this.importButton2);87 65 this.Controls.Add(this.importButton); 88 66 this.Name = "VehicleRoutingProblemView"; 89 67 this.Size = new System.Drawing.Size(490, 352); 90 68 this.Controls.SetChildIndex(this.importButton, 0); 91 this.Controls.SetChildIndex(this.importButton2, 0); 92 this.Controls.SetChildIndex(this.importButton3, 0); 69 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 93 70 this.Controls.SetChildIndex(this.nameTextBox, 0); 94 71 this.Controls.SetChildIndex(this.nameLabel, 0); 95 72 this.Controls.SetChildIndex(this.descriptionLabel, 0); 96 73 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 97 this.Controls.SetChildIndex(this.parameterCollectionView, 0);98 74 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 99 75 this.ResumeLayout(false); … … 105 81 106 82 private System.Windows.Forms.Button importButton; 107 private System.Windows.Forms.Button importButton2;108 private System.Windows.Forms.Button importButton3;109 83 private Core.Views.ParameterCollectionView parameterCollectionView; 110 84 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.cs
r4362 r4860 26 26 using HeuristicLab.Core.Views; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.PluginInfrastructure; 28 29 29 30 namespace HeuristicLab.Problems.VehicleRouting.Views { … … 31 32 [Content(typeof(VehicleRoutingProblem), true)] 32 33 public partial class VehicleRoutingProblemView : NamedItemView { 34 private VRPImportDialog vrpImportDialog; 35 33 36 public new VehicleRoutingProblem Content { 34 37 get { return (VehicleRoutingProblem)base.Content; } … … 59 62 base.SetEnabledStateOfControls(); 60 63 parameterCollectionView.Enabled = Content != null; 61 importButton.Enabled = importButton2.Enabled = importButton3.Enabled =Content != null && !ReadOnly;64 importButton.Enabled = Content != null && !ReadOnly; 62 65 } 63 66 64 67 private void importButton_Click(object sender, EventArgs e) { 65 OpenFileDialog dialog = new OpenFileDialog(); 66 dialog.Filter = "Solomon files (*.txt)|*.txt"; 68 if (vrpImportDialog == null) vrpImportDialog = new VRPImportDialog(); 67 69 68 if (dialog.ShowDialog() == DialogResult.OK) { 69 Content.ImportFromSolomon(dialog.FileName); 70 if (vrpImportDialog.ShowDialog(this) == DialogResult.OK) { 71 try { 72 switch (vrpImportDialog.Format) { 73 case VRPFormat.TSPLib: 74 Content.ImportFromTSPLib(vrpImportDialog.VRPFileName); 75 break; 76 77 case VRPFormat.Solomon: 78 Content.ImportFromSolomon(vrpImportDialog.VRPFileName); 79 break; 80 81 case VRPFormat.ORLib: 82 Content.ImportFromORLib(vrpImportDialog.VRPFileName); 83 break; 84 } 85 86 if (!string.IsNullOrEmpty(vrpImportDialog.TourFileName)) 87 Content.ImportSolution(vrpImportDialog.TourFileName); 88 } 89 catch (Exception ex) { 90 ErrorHandling.ShowErrorDialog(this, ex); 91 } 70 92 } 71 } 72 73 private void importButton2_Click(object sender, EventArgs e) { 74 OpenFileDialog dialog = new OpenFileDialog(); 75 dialog.Filter = "TSPLib files (*.vrp)|*.vrp"; 76 77 if (dialog.ShowDialog() == DialogResult.OK) { 78 Content.ImportFromTSPLib(dialog.FileName); 79 } 80 } 81 82 private void importButton3_Click(object sender, EventArgs e) { 83 OpenFileDialog dialog = new OpenFileDialog(); 84 dialog.Filter = "ORLib files (*.txt)|*.txt"; 85 86 if (dialog.ShowDialog() == DialogResult.OK) { 87 Content.ImportFromORLib(dialog.FileName); 88 } 89 } 93 } 90 94 } 91 95 }
Note: See TracChangeset
for help on using the changeset viewer.