private void butConvertToOutputField_Click(object sender, RoutedEventArgs e) { this.Model = ScreenItemModel.Factory(ShowItemType.Field, this.Model); (this.Model as ScreenFieldModel).Usage = ShowUsage.Output; this.ModelTypeChanged = true; AcceptEntry(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { this.Model = ScreenItemModel.Factory(this.ScreenItemModel); this.DataContext = this; // screenSection. Make the window larger. if (this.Model is IScreenSection) { this.Width += 150; this.Height += 250; } }
private void EnumRadioButton_EnumValueChanged( Enum wasValue, Enum currentValue, AutoCoder.Controls.EnumRadioButton arg2) { var itemType = (ShowItemType)currentValue; ShowItemType?wasType = (ShowItemType?)wasValue; // type of the ScreenItem has been changed. Create a new ItemModel that // matches the new item type. if ((wasType != null) && (wasType.Value != itemType)) { this.Model = ScreenItemModel.Factory(itemType, this.Model); this.ModelTypeChanged = true; AcceptEntry(); } }
private IScreenItem Paste_Actual( RelativePosition Rltv, ISectionHeader ToSectionHeader, int ToIndex = -1) { int toIndex = ToIndex; IScreenItem lastPasteItem = null; if (ToIndex >= 0) { lastPasteItem = ToSectionHeader.GetItemAt(ToIndex); } var rltv = Rltv; foreach (var item in this) { IScreenItem pasteItem = null; // remove from the from list. if (item.CopyPasteCode == CopyPasteCode.Cut) { pasteItem = item.Cut(); } // dup the item to copy. if (item.CopyPasteCode == CopyPasteCode.Copy) { pasteItem = ScreenItemModel.Factory(item.ScreenItem); pasteItem.AssignItemGuid(); } // index of the insert relative to item. toIndex = -1; if (lastPasteItem != null) { toIndex = ToSectionHeader.Items.IndexOf(lastPasteItem); } // insert into ToList. if (rltv == RelativePosition.After) { ToSectionHeader.InsertItemAfter(toIndex, pasteItem); } else if (rltv == RelativePosition.Begin) { ToSectionHeader.InsertItemBegin(pasteItem); } else if (rltv == RelativePosition.End) { ToSectionHeader.AddItem(pasteItem); } else if (rltv == RelativePosition.Before) { ToSectionHeader.InsertItemBefore(toIndex, pasteItem); } else { throw new Exception("invalid relative postion"); } // clear the copy/paste marking on the screenItem. if (this.IsGlobalList == true) { item.ScreenItem.CopyPasteCode = null; } // the last pasted item. lastPasteItem = pasteItem; // subsequent items are placed after the prior pasted item rltv = RelativePosition.After; } // clear the list of pending actions. this.Clear(); return(lastPasteItem); }