private int ExportSpecifiedDeductionValuesAndGetAvailableMaterialCount(List <Action> deductionSelectionCommandList) { var settingsDialog = HomeZone.GotoMainMenu().OpenSettingsDialog(); var bendSettings = settingsDialog.BendSettings; bendSettings.Goto(); bendSettings.OpenDataManagerBend(); DatamanagerBend.MainWindowExists.WaitFor(TestSettings.DatamanagerBendStartTimeout); DatamanagerBend.DeductionValues.Goto(); DatamanagerBend.DeductionValues.ExportTBSCSV(); foreach (var cmd in deductionSelectionCommandList) { cmd.Invoke(); } IListBox listBox = Driver.Find <IProcess>(new ProcessPattern() { ProcessName = "DataManager" }).Find <IControl>(new WPFPattern() { ClrFullClassName = "Trumpf.TruTops.DataMigrationTool.Views.Bend_Factor_Explorer.TcBendFactorTbsExportDialog" }, 2).Find <IListBox>(new WPFPattern() { ClrFullClassName = "System.Windows.Controls.ListBox" }, 2); var selectedItemsCount = listBox.wSelected.Count(); DatamanagerBend.DeductionValues.TBSExportDialog.Export(); DatamanagerBend.Close(); settingsDialog.Save(); return(selectedItemsCount); }
protected override void AppendSpecificTypeProperties(StringBuilder builder) { if (_widget.WidgetType == WidgetType.ListBox) { IListBox listBox = _widget as IListBox; builder.AppendFormat("\"allowMultiple\":{0},", listBox.AllowMultiple.ToString().ToLower()); } IListBase listBase = _widget as IListBase; builder.Append("\"items\":["); foreach (IListItem item in listBase.Items) { builder.Append("{"); builder.AppendFormat("\"textValue\":\"{0}\",", JsHelper.ReplaceSpecialCharacters(item.TextValue)); builder.AppendFormat("\"isSelected\":{0},", item.IsSelected.ToString().ToLower()); builder.Append("},"); } JsHelper.RemoveLastComma(builder); builder.Append("],"); }
public void TestCreateListBox() { //---------------Set up test pack------------------- //---------------Execute Test ---------------------- IListBox myListBox = GetControlFactory().CreateListBox(); //---------------Test Result ----------------------- Assert.IsNotNull(myListBox); //---------------Tear Down ------------------------- }
public void TestListBoxItems() { //---------------Set up test pack------------------- IListBox myListBox = GetControlFactory().CreateListBox(); //---------------Execute Test ---------------------- myListBox.Items.Add("testitem"); //---------------Test Result ----------------------- Assert.AreEqual(1, myListBox.Items.Count); //---------------Tear Down ------------------------- }
public void TestConstructor() { //---------------Set up test pack------------------- IListBox listBox = CreateListBox(); //---------------Execute Test ---------------------- var manager = CreateListBoxCollectionManager(listBox); //---------------Test Result ----------------------- Assert.IsNotNull(manager); Assert.AreSame(listBox, manager.Control); //---------------Tear Down ------------------------- }
/// <summary> /// New subset form. /// </summary> public SubsetForm() { Title = "Select"; Dialog.KeyPressed += OnKeyPressed; // "available" and "selected" list const int L1 = 4; const int R2 = DLG_XSIZE - 5; const int R1 = (L1 + R2) / 2; const int L2 = R1 + 1; const int BB = DLG_YSIZE - 4; _ListBox1 = Dialog.AddListBox(L1, 2, R1, BB, "Available"); _ListBox1.NoClose = true; _ListBox1.MouseClicked += OnListBox1Clicked; _ListBox2 = Dialog.AddListBox(L2, 2, R2, BB, "Selected"); _ListBox2.NoClose = true; _ListBox2.MouseClicked += OnListBox2Clicked; // buttons const int yButton = DLG_YSIZE - 3; IButton button; button = Dialog.AddButton(0, yButton, "Add"); button.CenterGroup = true; button.ButtonClicked += OnAddButtonClicked; button = Dialog.AddButton(0, yButton, "Remove"); button.CenterGroup = true; button.ButtonClicked += OnRemoveButtonClicked; button = Dialog.AddButton(0, yButton, "Up"); button.CenterGroup = true; button.ButtonClicked += OnUpButtonClicked; button = Dialog.AddButton(0, yButton, "Down"); button.CenterGroup = true; button.ButtonClicked += OnDownButtonClicked; button = Dialog.AddButton(0, yButton, "OK"); button.CenterGroup = true; Dialog.Default = button; button = Dialog.AddButton(0, yButton, "Cancel"); button.CenterGroup = true; Dialog.Cancel = button; }
/// <summary> /// New subset form. /// </summary> public SubsetForm() { Title = "Select"; Dialog.KeyPressed += OnKeyPressed; // "available" and "selected" list const int L1 = 4; const int R2 = DLG_XSIZE - 5; const int R1 = (L1 + R2) / 2; const int L2 = R1 + 1; const int BB = DLG_YSIZE - 4; _ListBox1 = Dialog.AddListBox(L1, 2, R1, BB, "Available"); _ListBox1.NoClose = true; _ListBox1.MouseClicked += OnListBox1Clicked; _ListBox2 = Dialog.AddListBox(L2, 2, R2, BB, "Selected"); _ListBox2.NoClose = true; _ListBox2.MouseClicked += OnListBox2Clicked; // buttons const int yButton = DLG_YSIZE - 3; IButton button; button = Dialog.AddButton(0, yButton, "Add"); button.CenterGroup = true; button.ButtonClicked += OnAddButtonClicked; button = Dialog.AddButton(0, yButton, "Remove"); button.CenterGroup = true; button.ButtonClicked += OnRemoveButtonClicked; button = Dialog.AddButton(0, yButton, "Up"); button.CenterGroup = true; button.ButtonClicked += OnUpButtonClicked; button = Dialog.AddButton(0, yButton, "Down"); button.CenterGroup = true; button.ButtonClicked += OnDownButtonClicked; button = Dialog.AddButton(0, yButton, "OK"); button.CenterGroup = true; Dialog.Default = button; button = Dialog.AddButton(0, yButton, "Cancel"); button.CenterGroup = true; Dialog.Cancel = button; }
public void TestSetCollectionNull() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); MyBO.LoadClassDefWithBoolean(); IListBox cmb = CreateListBox(); var selector = CreateListBoxCollectionManager(cmb); //---------------Verify test pack------------------- //---------------Execute Test ---------------------- selector.SetCollection(null); //---------------Verify Result ----------------------- Assert.IsNull(selector.Collection); Assert.AreSame(cmb, selector.Control); }
public void TestSetListBoxCollection() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); IListBox listBox = CreateListBox(); var manager = CreateListBoxCollectionManager(listBox); MyBO.LoadDefaultClassDef(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> { new MyBO(), new MyBO(), new MyBO() }; //---------------Execute Test ---------------------- manager.SetCollection(myBoCol); //---------------Test Result ----------------------- Assert.AreEqual(3, manager.Collection.Count); //---------------Tear down ------------------------- }
public void TestBusinessObejctAddedToCollection_ShouldAddToItems() { ClassDef.ClassDefs.Clear(); IListBox listBox = CreateListBox(); var manager = CreateListBoxCollectionManager(listBox); MyBO.LoadDefaultClassDef(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO>(); MyBO addedBo = new MyBO(); myBoCol.Add(new MyBO()); myBoCol.Add(new MyBO()); myBoCol.Add(new MyBO()); manager.SetCollection(myBoCol); //---------------Execute Test ---------------------- manager.Collection.Add(addedBo); //---------------Test Result ----------------------- Assert.AreEqual(4, manager.Control.Items.Count); }
public virtual void TestSelectingMultipleItemsAtOnce_Click() { //---------------Set up test pack------------------- IMultiSelector <TestT> _selector = GetControlFactory().CreateMultiSelector <TestT>(); _selector.AllOptions = CreateListWithTwoOptions(); ReadOnlyCollection <TestT> options = _selector.Model.OptionsView; IListBox availableOptionsListbox = _selector.AvailableOptionsListBox; availableOptionsListbox.SelectedItems.Add(options[0]); availableOptionsListbox.SelectedItems.Add(options[1]); //---------------Execute Test ---------------------- _selector.GetButton(MultiSelectorButton.Select).PerformClick(); //---------------Test Result ----------------------- AssertAllSelected(_selector); Assert.AreEqual(_selector.SelectedOptionsListBox.Items.Count, _selector.SelectionsView.Count); //---------------Tear Down ------------------------- }
public void TestSelectedBusinessObject() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); IListBox listBox = CreateListBox(); var manager = CreateListBoxCollectionManager(listBox); MyBO.LoadDefaultClassDef(); BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO>(); MyBO selectedBO = new MyBO(); myBoCol.Add(new MyBO()); myBoCol.Add(selectedBO); myBoCol.Add(new MyBO()); //---------------Execute Test ---------------------- manager.SetCollection(myBoCol); manager.Control.SelectedIndex = 1; //---------------Test Result ----------------------- Assert.AreEqual(selectedBO, manager.SelectedBusinessObject); //---------------Tear down ------------------------- }
public virtual void TestSelectingIListBoxItemsCollectionEnumerator() { //---------------Set up test pack------------------- IMultiSelector <TestT> _selector = GetControlFactory().CreateMultiSelector <TestT>(); _selector.AllOptions = CreateListWithTwoOptions(); ReadOnlyCollection <TestT> options = _selector.Model.OptionsView; IListBox availableOptionsListbox = _selector.AvailableOptionsListBox; availableOptionsListbox.SelectedItems.Add(options[0]); availableOptionsListbox.SelectedItems.Add(options[1]); //---------------Execute Test ---------------------- _selector.GetButton(MultiSelectorButton.Select).PerformClick(); //---------------Test Result ----------------------- foreach (object o in _selector.SelectedOptionsListBox.Items) { Assert.IsNotNull(o); } //---------------Tear Down ------------------------- }
public void TestCreateTestListBoxCollectionController() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); MyBO.LoadClassDefWithBoolean(); BusinessObjectCollection <MyBO> myBOs = new BusinessObjectCollection <MyBO>(); MyBO myBO1 = new MyBO(); MyBO myBO2 = new MyBO(); myBOs.Add(myBO1, myBO2); IListBox cmb = CreateListBox(); var selector = CreateListBoxCollectionManager(cmb); //---------------Verify test pack------------------- //---------------Execute Test ---------------------- selector.SetCollection(myBOs); //---------------Verify Result ----------------------- Assert.AreEqual(myBOs, selector.Collection); Assert.AreSame(cmb, selector.Control); //---------------Tear Down ------------------------- }
protected override void RunInternal() { // Create a new document. Program.Service.NewDocument(DocumentType.Standard); IDocument document = Program.Service.Document; // Create a page note field. document.PageAnnotationFieldSet.CreateAnnotationField("Default", AnnotationFieldType.Text); // Create some widget note fields. document.WidgetAnnotationFieldSet.CreateAnnotationField("Description", AnnotationFieldType.Text); document.WidgetAnnotationFieldSet.CreateAnnotationField("CreatedTime", AnnotationFieldType.Text); // Create a device. IDevice devide = document.DeviceSet.CreateDevice("iPhone 6 Plus"); devide.Width = 1024; devide.Height = 768; devide.IsChecked = true; // Create a page. IDocumentPage page = document.CreatePage("Home"); // Create the page node in page tree. ITreeNode node = document.DocumentSettings.LayoutSetting.PageTree.AddChild(TreeNodeType.Page); node.AttachedObject = page; // Must open the page before you read and modify it. page.Open(); // Set page note. page.Annotation.SetTextValue("Default", "This Home page."); // Get the page view for base adaptive view. IPageView baseView = page.PageViews[document.AdaptiveViewSet.Base.Guid]; // Create widgets on the base view in this page. IButton button = baseView.CreateWidget(WidgetType.Button) as IButton; button.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); // Size button.WidgetStyle.Height = 30; button.WidgetStyle.Width = 100; // Location button.WidgetStyle.X = 0; button.WidgetStyle.Y = 0; button.WidgetStyle.Z = 0; // Text things button.Name = "Button 1"; button.Text = "Button"; button.Tooltip = "Html button."; ICheckbox checkbox = baseView.CreateWidget(WidgetType.Checkbox) as ICheckbox; checkbox.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); checkbox.WidgetStyle.Height = 18; checkbox.WidgetStyle.Width = 120; checkbox.WidgetStyle.X = 150; checkbox.WidgetStyle.Y = 0; checkbox.WidgetStyle.Z = 1; checkbox.Name = "CheckBox 1"; checkbox.Text = "CheckBox"; checkbox.Tooltip = "Left align check box."; IDroplist dropList = baseView.CreateWidget(WidgetType.DropList) as IDroplist; dropList.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); dropList.WidgetStyle.Height = 22; dropList.WidgetStyle.Width = 200; dropList.WidgetStyle.X = 300; dropList.WidgetStyle.Y = 0; dropList.WidgetStyle.Z = 2; dropList.Name = "Droplist 1"; dropList.Tooltip = "A droplist has 3 item and item 3 is seleted."; // Create list items. dropList.CreateItem("Droplist Item 1"); dropList.CreateItem("Droplist Item 2"); IListItem item3 = dropList.CreateItem("Droplist Item 3"); item3.IsSelected = true; /* * IFlowShape flowShap = baseView.CreateWidget(WidgetType.FlowShape) as IFlowShape; // Here flow shape type is none. * // You must set specific flow shape type, then the flowshape is a valid flowshape. * flowShap.FlowShapeType = FlowShapeType.Database; * flowShap.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); * flowShap.Height = 80; * flowShap.Width = 60; * flowShap.X = 550; * flowShap.Y = 0; * flowShap.Z = 3; * flowShap.Name = "FlowShape 1"; * flowShap.Tooltip = "A Database flow shape."; * flowShap.SetRichText("Database"); // FlowShape support rich text. */ IHotSpot hotSpot = baseView.CreateWidget(WidgetType.HotSpot) as IHotSpot; hotSpot.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); hotSpot.WidgetStyle.Height = 100; hotSpot.WidgetStyle.Width = 100; hotSpot.WidgetStyle.X = 0; hotSpot.WidgetStyle.Y = 100; hotSpot.WidgetStyle.Z = 4; hotSpot.Name = "HotSpot 1"; hotSpot.Tooltip = "A hot sport link to Baidu"; // Create a link action to open www.baidu.com in new window. IInteractionEvent clickEvent = hotSpot.Events[EventType.OnClick]; IInteractionCase case1 = clickEvent.CreateCase("clickCase"); IInteractionOpenAction openAction = case1.CreateAction(ActionType.OpenAction) as IInteractionOpenAction; openAction.LinkType = LinkType.LinkToUrl; openAction.ExternalUrl = @"www.baidu.com"; openAction.OpenIn = ActionOpenIn.NewWindowOrTab; IImage image = baseView.CreateWidget(WidgetType.Image) as IImage; image.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); image.WidgetStyle.Height = 267; image.WidgetStyle.Width = 116; image.WidgetStyle.X = 150; image.WidgetStyle.Y = 100; image.WidgetStyle.Z = 5; image.Name = "4.png"; image.Tooltip = "A png image has 116 x 267 in size"; // It is a png image by default. Set image stream string imageFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "HangGame", "4.png"); if (File.Exists(imageFile)) { using (FileStream fileStream = new FileStream(imageFile, FileMode.Open, FileAccess.Read)) { MemoryStream imageStream = new MemoryStream(); fileStream.CopyTo(imageStream); image.ImageStream = imageStream; } } ILine line = baseView.CreateWidget(WidgetType.Line) as ILine; line.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); line.Orientation = Orientation.Vertical; line.WidgetStyle.Height = 200; line.WidgetStyle.Width = 10; line.WidgetStyle.X = 300; line.WidgetStyle.Y = 100; line.WidgetStyle.Z = 6; line.Name = "Line"; line.Tooltip = "A Vertical line with"; IListBox listBox = baseView.CreateWidget(WidgetType.ListBox) as IListBox; listBox.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); listBox.WidgetStyle.Height = 100; listBox.WidgetStyle.Width = 200; listBox.WidgetStyle.X = 350; listBox.WidgetStyle.Y = 100; listBox.WidgetStyle.Z = 7; listBox.Tooltip = "A multiple-selected listBox which has 5 itmes. Item 1 and item 4 is selcted."; listBox.AllowMultiple = true; IListItem item1 = listBox.CreateItem("ListBox Item 1"); item1.IsSelected = true; listBox.CreateItem("ListBox Item 2"); listBox.CreateItem("ListBox Item 3"); IListItem item4 = listBox.CreateItem("ListBox Item 4"); item4.IsSelected = true; listBox.CreateItem("ListBox Item 5"); IRadioButton radioButton = baseView.CreateWidget(WidgetType.RadioButton) as IRadioButton; radioButton.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); radioButton.WidgetStyle.Height = 18; radioButton.WidgetStyle.Width = 120; radioButton.WidgetStyle.X = 0; radioButton.WidgetStyle.Y = 300; radioButton.WidgetStyle.Z = 8; radioButton.AlignButton = AlignButton.Right; radioButton.Text = "Radio Button"; radioButton.Tooltip = "A right aligned radio button"; IShape lable = baseView.CreateWidget(WidgetType.Shape) as IShape; lable.ShapeType = ShapeType.Paragraph; lable.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); lable.WidgetStyle.Height = 100; lable.WidgetStyle.Width = 200; lable.WidgetStyle.X = 150; lable.WidgetStyle.Y = 300; lable.WidgetStyle.Z = 9; lable.Name = "Label 1"; lable.Tooltip = "A label."; lable.SetRichText("Label"); lable.WidgetStyle.LineColor = new StyleColor(ColorFillType.Solid, -16777216); lable.WidgetStyle.LineWidth = 0; // No border lable.WidgetStyle.FillColor = new StyleColor(ColorFillType.Solid, 16777215); // Transparent lable.WidgetStyle.HorzAlign = Alignment.Left; lable.WidgetStyle.VertAlign = Alignment.Top; IShape roundedRectangle = baseView.CreateWidget(WidgetType.Shape) as IShape; roundedRectangle.ShapeType = ShapeType.RoundedRectangle; roundedRectangle.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); roundedRectangle.WidgetStyle.Height = 100; roundedRectangle.WidgetStyle.Width = 200; roundedRectangle.WidgetStyle.X = 400; roundedRectangle.WidgetStyle.Y = 300; roundedRectangle.WidgetStyle.Z = 10; roundedRectangle.Name = "RoundedRectangle 1"; roundedRectangle.Tooltip = "A Rounded Rectangle."; roundedRectangle.SetRichText("RoundedRectangle"); IShape triangle = baseView.CreateWidget(WidgetType.Shape) as IShape; triangle.ShapeType = ShapeType.Triangle; triangle.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); triangle.WidgetStyle.Height = 100; triangle.WidgetStyle.Width = 100; triangle.WidgetStyle.X = 650; triangle.WidgetStyle.Y = 300; triangle.WidgetStyle.Z = 11; triangle.Name = "Triangle 1"; triangle.Tooltip = "A Triangle."; triangle.SetRichText("Triangle"); ISvg svg = baseView.CreateWidget(WidgetType.SVG) as ISvg; svg.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); svg.WidgetStyle.Height = 117; svg.WidgetStyle.Width = 150; svg.WidgetStyle.X = 0; svg.WidgetStyle.Y = 450; svg.WidgetStyle.Z = 12; svg.Name = "airplane 03"; svg.Tooltip = "A airplane svg"; string svgFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "Svg", "airplane 03.svg"); if (File.Exists(svgFile)) { using (FileStream fileStream = new FileStream(svgFile, FileMode.Open, FileAccess.Read)) { MemoryStream svgStream = new MemoryStream(); fileStream.CopyTo(svgStream); svg.XmlStream = svgStream; } } ITextArea textArea = baseView.CreateWidget(WidgetType.TextArea) as ITextArea; textArea.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); textArea.WidgetStyle.Height = 100; textArea.WidgetStyle.Width = 200; textArea.WidgetStyle.X = 250; textArea.WidgetStyle.Y = 450; textArea.WidgetStyle.Z = 12; textArea.Name = "TextArea 1"; textArea.Tooltip = "A hidden border text area with max length is 10."; textArea.HintText = "Password"; textArea.MaxLength = 10; textArea.HideBorder = true; ITextField textField = baseView.CreateWidget(WidgetType.TextField) as ITextField; textField.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); textField.WidgetStyle.Height = 50; textField.WidgetStyle.Width = 100; textField.WidgetStyle.X = 500; textField.WidgetStyle.Y = 450; textField.WidgetStyle.Z = 13; textField.Name = "TextField 1"; textField.Tooltip = "A TextField"; textField.TextFieldType = TextFieldType.Email; textField.HintText = "emial"; IHamburgerMenu hamburgerMenu = baseView.CreateWidget(WidgetType.HamburgerMenu) as IHamburgerMenu; hamburgerMenu.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); hamburgerMenu.WidgetStyle.Height = 280; hamburgerMenu.WidgetStyle.Width = 150; hamburgerMenu.WidgetStyle.X = 0; hamburgerMenu.WidgetStyle.Y = 700; hamburgerMenu.WidgetStyle.Z = 14; hamburgerMenu.Name = "HamburgerMenu 1"; hamburgerMenu.Tooltip = "A hamburger menu."; // Menu botton hamburgerMenu.MenuButton.WidgetStyle.Height = 50; hamburgerMenu.MenuButton.WidgetStyle.Width = 50; hamburgerMenu.MenuButton.WidgetStyle.X = 0; hamburgerMenu.MenuButton.WidgetStyle.Y = 700; hamburgerMenu.MenuButton.WidgetStyle.Z = 0; // Menu page, add a shape IPage menuPage = hamburgerMenu.MenuPage; menuPage.Open(); // Open page to edit. // Get the base view of menu page. IPageView menuBaseView = menuPage.PageViews[document.AdaptiveViewSet.Base.Guid]; // Create widgts on the base view in the menu page. IShape diamond = menuBaseView.CreateWidget(WidgetType.Shape) as IShape; diamond.ShapeType = ShapeType.Diamond; diamond.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); diamond.WidgetStyle.Height = 100; diamond.WidgetStyle.Width = 100; diamond.Name = "Diamond 1"; diamond.Tooltip = "A Diamond."; diamond.SetRichText("Diamond"); menuPage.Close(); // Close Page to release resources. IToast toast = baseView.CreateWidget(WidgetType.Toast) as IToast; toast.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); toast.WidgetStyle.Height = 146; toast.WidgetStyle.Width = 298; toast.WidgetStyle.X = 200; toast.WidgetStyle.Y = 700; toast.WidgetStyle.Z = 15; toast.Name = "Toast 1"; toast.Tooltip = "A ExposureTime toast."; toast.ExposureTime = 3; toast.DisplayPosition = ToastDisplayPosition.Top; toast.CloseSetting = ToastCloseSetting.CloseButton; IPage toastPage = toast.ToastPage; toastPage.Open(); // Open page to edit. // Get the base view of toast page. IPageView toastBaseView = toastPage.PageViews[document.AdaptiveViewSet.Base.Guid]; IShape ellipse = toastBaseView.CreateWidget(WidgetType.Shape) as IShape; ellipse.ShapeType = ShapeType.Ellipse; ellipse.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); ellipse.WidgetStyle.Height = 100; ellipse.WidgetStyle.Width = 100; ellipse.Name = "Ellipse 1"; ellipse.Tooltip = "A Ellipse."; ellipse.SetRichText("Ellipse"); toastPage.Close(); // Close Page to release resources. IDynamicPanel dynamicPanel = baseView.CreateWidget(WidgetType.DynamicPanel) as IDynamicPanel; dynamicPanel.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); dynamicPanel.WidgetStyle.Height = 198; dynamicPanel.WidgetStyle.Width = 152; dynamicPanel.WidgetStyle.X = 500; dynamicPanel.WidgetStyle.Y = 700; dynamicPanel.WidgetStyle.Z = 16; dynamicPanel.IsAutomatic = true; // Set start panel page as the first created page. dynamicPanel.StartPanelStatePage = dynamicPanel.CreatePanelStatePage("Panel 1"); dynamicPanel.CreatePanelStatePage("Panel 2"); dynamicPanel.CreatePanelStatePage("Panel 3"); int imageFileName = 1; foreach (IPage statePage in dynamicPanel.PanelStatePages) { statePage.Open(); // Open page to edit. // Get the base view of state page. IPageView stateBaseView = statePage.PageViews[document.AdaptiveViewSet.Base.Guid]; IImage statePageImage = stateBaseView.CreateWidget(WidgetType.Image) as IImage; statePageImage.Annotation.SetTextValue("CreatedTime", DateTime.Now.ToString()); statePageImage.WidgetStyle.Height = 198; statePageImage.WidgetStyle.Width = 152; string statePageImageFile = Path.Combine(Program.WORKING_IMAGES_DIRECTORY, "HangGame", imageFileName + ".png"); if (File.Exists(statePageImageFile)) { using (FileStream fileStream = new FileStream(statePageImageFile, FileMode.Open, FileAccess.Read)) { MemoryStream imageStream = new MemoryStream(); fileStream.CopyTo(imageStream); statePageImage.ImageStream = imageStream; } } statePage.Close(); // Close Page to release resources. imageFileName++; } // Close the page if you don't want to work on it. page.Close(); // Save the document to a pn file. string fileName = Path.Combine(Program.WORKING_DIRECTORY, _caseName + ".pn"); Program.Service.Save(fileName); // Close this document when you don't work on it anymore. Program.Service.Close(); }
public void Update(IListBox newWdg) { _element = newWdg; base.Update(newWdg); InitializeProperty(); }
public SerialListBox(IListBox wdg) : base(wdg) { _element = wdg; InitializeProperty(); }
public ListBox(Generator g) : base(g, typeof(IListBox)) { inner = (IListBox)Handler; }
public DebuggerDialog(DebuggerStopEventArgs e) { _InvocationInfo = e.InvocationInfo; int maxLine = 0; string[] lines = null; if (!string.IsNullOrEmpty(e.InvocationInfo.ScriptName) && File.Exists(e.InvocationInfo.ScriptName)) { try { lines = File.ReadAllLines(e.InvocationInfo.ScriptName, Encoding.Default); foreach (string s in lines) { if (s.Length > maxLine) { maxLine = s.Length; } } } catch (IOException) { } } int dw = Math.Max(Math.Min(Far.Api.UI.WindowSize.X - 7, maxLine + 12), 73); int dh = 22; string title; int h1; if (e.Breakpoints.Count > 0) { title = "DEBUG: Hit breakpoint(s)"; h1 = e.Breakpoints.Count + 2; } else { title = "DEBUG: Step"; h1 = 2; } _Dialog = Far.Api.CreateDialog(-1, -1, dw, dh); _Dialog.HelpTopic = Far.Api.GetHelpTopic("DebuggerDialog"); _Dialog.AddBox(3, 1, dw - 4, dh - 2, title); _List1 = _Dialog.AddListBox(4, 2, dw - 5, h1 + 1, null); _List1.Disabled = true; _List1.NoBox = true; _List1.NoClose = true; _List1.NoFocus = true; if (e.Breakpoints.Count > 0) { foreach (Breakpoint bp in e.Breakpoints) { CommandBreakpoint bpc = bp as CommandBreakpoint; if (bpc != null && Kit.Equals(bpc.Command, Commands.AssertFarCommand.MyName)) { A.InvokeCode("Remove-PSBreakpoint -Breakpoint $args[0]", bpc); } } } foreach (string s in e.InvocationInfo.PositionMessage.Trim().Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)) { _List1.Add(s); } _Dialog.AddText(0, -_List1.Rect.Height, 0, null).Separator = 1; _List2 = _Dialog.AddListBox(4, _List1.Rect.Bottom + 2, dw - 5, dh - 5, null); _List2.NoBox = true; _List2.NoClose = true; if (lines != null) { foreach (string s in lines) { _List2.Add(s); } int i = e.InvocationInfo.ScriptLineNumber - 1; _List2.Items[i].Checked = true; } _Dialog.AddText(0, -_List2.Rect.Height, 0, null).Separator = 1; _Step = _Dialog.AddButton(0, -1, BtnStep); _Step.CenterGroup = true; _Over = _Dialog.AddButton(0, 0, BtnOver); _Over.CenterGroup = true; _Out = _Dialog.AddButton(0, 0, BtnOut); _Out.CenterGroup = true; _Console = _Dialog.AddButton(0, 0, BtnInteractive); _Console.CenterGroup = true; _Console.NoBrackets = true; _Edit = _Dialog.AddButton(0, 0, BtnEdit); _Edit.CenterGroup = true; _Edit.NoBrackets = true; // to be completed on show _View = _Dialog.AddButton(0, 0, BtnView); _View.CenterGroup = true; _View.NoBrackets = true; _View.NoClose = true; _Goto = _Dialog.AddButton(0, 0, BtnLine); _Goto.CenterGroup = true; _Goto.NoBrackets = true; _Goto.NoClose = true; _Goto.ButtonClicked += OnGoto; _Quit = _Dialog.AddButton(0, 0, BtnQuit); _Quit.CenterGroup = true; _Quit.NoBrackets = true; _Dialog.Initialized += OnInitialized; }
protected ListBox(Generator generator, Type type, bool initialize = true) : base(generator, type, initialize) { handler = (IListBox)Handler; }
protected ListBox (Generator generator, Type type, bool initialize = true) : base (generator, type, initialize) { handler = (IListBox)Handler; }
public QuickEntryMediator(ITextBox textBox, IListBox listBox) { _textBox = textBox; _listBox = listBox; _textBox.TextEntered += OnTextEntered; }
protected static ListBoxCollectionManager CreateListBoxCollectionManager(IListBox listBox) { return new ListBoxCollectionManager(listBox); }
protected static ListBoxCollectionManager CreateListBoxCollectionManager(IListBox listBox) { return(new ListBoxCollectionManager(listBox)); }
public override bool Show() { //! drop filter indexes because they are invalid on the second show if items have changed _ii = null; _toFilter = true; // main loop for (int pass = 0; ; ++pass) { // filter MakeFilter(); // filtered item number int nItem2 = _ii == null ? myItems.Count : _ii.Count; if (nItem2 < 2 && AutoSelect) { if (nItem2 == 1) { Selected = _ii == null ? 0 : _ii[0]; return(true); } else if (pass == 0) { Selected = -1; return(false); } } // title, bottom GetInfo(out string title, out string info); // dialog var dialog = Far.Api.CreateDialog(1, 1, 1, 1); dialog.HelpTopic = string.IsNullOrEmpty(HelpTopic) ? "list-menu" : HelpTopic; dialog.NoShadow = NoShadow; dialog.TypeId = TypeId; // title dialog.AddBox(1, 1, 1, 1, title); // list _box = dialog.AddListBox(1, 1, 1, 1, string.Empty); _box.Selected = Selected; _box.SelectLast = SelectLast; _box.NoBox = true; _box.WrapCursor = WrapCursor; if (IncrementalOptions == PatternOptions.None) { _box.AutoAssignHotkeys = AutoAssignHotkeys; _box.NoAmpersands = !ShowAmpersands; } // "bottom" if (info.Length > 0) { dialog.AddText(1, 1, 1, info); } // items and filter _box.ReplaceItems(myItems, _ii); // now we are ready to make sizes MakeSizes(dialog, Far.Api.UI.WindowSize); // handlers dialog.ConsoleSizeChanged += OnConsoleSizeChanged; _box.KeyPressed += OnKeyPressed; // go! _toFilter = _isKeyHandled = false; myKeyIndex = -1; bool ok = dialog.Show(); if (!ok) { return(false); } if (myKeyIndex == -2 || _toFilter) { continue; } // correct by filter Selected = _box.Selected; if (_ii != null && Selected >= 0) { Selected = _ii[Selected]; } // call click if a key was not handled yet if (Selected >= 0 && !_isKeyHandled) { var item = myItems[Selected]; if (item.Click != null) { var e = new MenuEventArgs(item); item.Click(Sender ?? this, e); if (e.Ignore || e.Restart) { continue; } } } //! empty + enter = -1 return(Selected >= 0); } }