Changeset 4453
- Timestamp:
- 09/20/10 15:08:50 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
r4447 r4453 178 178 179 179 int i = 0; 180 var query = from item in itemListViewItemTable.Keys 181 let views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == item) 182 where !views.Any(v => v.Locked) 183 select item; 184 T[] items = query.ToArray(); 180 T[] items = GetStorableItems(itemListViewItemTable.Keys); 185 181 186 182 foreach (T item in items) { … … 198 194 OnAllItemsSaved(); 199 195 } 196 200 197 private void OnItemSaved(T item, int progress) { 201 198 if (item != null) { … … 223 220 views.ForEach(v => v.Enabled = enabled); 224 221 } 222 } 223 224 private static T[] GetStorableItems(IEnumerable<T> items) { 225 var query = from item in items 226 let executeable = item as IExecutable 227 let views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == item) 228 where executeable == null || executeable.ExecutionState != ExecutionState.Started 229 where !views.Any(v => v.Locked) 230 select item; 231 T[] itemArray = query.ToArray(); 232 return itemArray; 225 233 } 226 234 #endregion … … 321 329 } 322 330 private void saveButton_Click(object sender, EventArgs e) { 323 var query = (from item in itemListViewItemTable.Keys 324 let views = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v.Content == item) 325 where views.Any(v => v.Locked) 326 select item.ToString()).ToArray(); 327 if (query.Length != 0) { 328 string itemNames = string.Join(Environment.NewLine, query); 329 MessageBox.Show("Could not save the following items, because they are locked (e.g. used in a running algorithm). All other items will be saved." + Environment.NewLine + itemNames); 331 IEnumerable<T> items = itemListViewItemTable.Keys.Except(GetStorableItems(itemListViewItemTable.Keys)); 332 if (items.Any()) { 333 string itemNames = string.Join(Environment.NewLine, items.Select(item => item.ToString()).ToArray()); 334 MessageBox.Show("The following items could not be saved, because they are locked (e.g. used in a running algorithm). All other items will be saved." + 335 Environment.NewLine + itemNames, "Could not save all items", MessageBoxButtons.OK, MessageBoxIcon.Warning); 330 336 } 331 337 Save(); -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.Designer.cs
r4011 r4453 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ViewHost)); 48 49 this.messageLabel = new System.Windows.Forms.Label(); 49 50 this.viewsLabel = new System.Windows.Forms.Label(); … … 68 69 this.viewsLabel.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Windows; 69 70 this.viewsLabel.Location = new System.Drawing.Point(211, 0); 70 this.viewsLabel.Margin = new System.Windows.Forms.Padding( 3);71 this.viewsLabel.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); 71 72 this.viewsLabel.Name = "viewsLabel"; 72 73 this.viewsLabel.Size = new System.Drawing.Size(16, 16); … … 74 75 this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view.\r\nRight-click to change cur" + 75 76 "rent view.\r\nDrag icon to copy or link content to another view."); 76 this.viewsLabel.MouseLeave += new System.EventHandler(this.viewsLabel_MouseLeave);77 77 this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick); 78 78 this.viewsLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.viewsLabel_MouseDown); 79 this.viewsLabel.MouseLeave += new System.EventHandler(this.viewsLabel_MouseLeave); 79 80 // 80 81 // viewContextMenuStrip 81 82 // 83 this.viewContextMenuStrip.IgnoredViewTypes = System.Linq.Enumerable.Empty<System.Type>(); 82 84 this.viewContextMenuStrip.Item = null; 83 85 this.viewContextMenuStrip.Name = "viewContextMenuStrip"; … … 94 96 this.Size = new System.Drawing.Size(227, 184); 95 97 this.ResumeLayout(false); 98 96 99 } 97 100
Note: See TracChangeset
for help on using the changeset viewer.