public TestPage1(IBrowserDriver driver) : base(driver) { InputField = driver.CreateTextField().FromID("TextField"); OutputField = driver.CreateTextField().FromID("TextFieldOutput"); Button = driver.CreateButton().FromID("UpdateButton"); }
protected override void AppendSpecificTypeProperties(StringBuilder builder) { base.AppendSpecificTypeProperties(builder); ITextBase textBase = _widget as ITextBase; builder.AppendFormat("\"hintText\":\"{0}\",", JsHelper.ReplaceSpecialCharacters(textBase.HintText)); builder.AppendFormat("\"hideBorder\":{0},", textBase.HideBorder.ToString().ToLower()); builder.AppendFormat("\"readOnly\":{0},", textBase.ReadOnly.ToString().ToLower()); if (textBase.MaxLength >= 0) { builder.AppendFormat("\"maxLength\":{0},", textBase.MaxLength); } else { // Negative value means unlimited. builder.AppendFormat("\"maxLength\": ,"); } if (_widget.WidgetType == WidgetType.TextField) { ITextField textField = _widget as ITextField; builder.AppendFormat("\"textFieldType\":\"{0}\",", textField.TextFieldType.ToString().ToLower()); } }
public static IHtmlString Render(this ITextField field, bool editable, params object[] formatParameters) { var isEditing = Sitecore.Context.PageMode.IsExperienceEditor; if (field.HasTextValue || isEditing) { if (editable) { string result = field.RenderedValue; if (!isEditing) { result = Format(field.RenderedValue, formatParameters); } return(new HtmlString(result)); } var richText = field as RichTextField; if (richText != null) { return(new HtmlString(Format(richText.ExpandedLinksValue, formatParameters))); } using (new DisplayModeSwitcher(DisplayMode.Normal)) { return(new HtmlString(Format(field.RenderedValue, formatParameters))); } } return(new HtmlString(string.Empty)); }
private void GetSkin(SkinFactory skinFactory) { IButton button = skinFactory.CreateButton(button1); IComboBox comboBox = skinFactory.CreateComboBox(comboBox1); ITextField textField = skinFactory.CreateTextField(textBox1); button.Display(); comboBox.Display(); textField.Display(); }
internal void InitializeFields() { var baseModelMetadata = BaseMetadata; if (baseModelMetadata != null) { foreach (var field in baseModelMetadata.fields) { AddField(field); } } foreach (var fieldInfo in ModelType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) { var field = fieldInfo.GetCustomAttribute <FieldProviderAttribute>(false); if (field == null) { continue; } InitializeField(field, fieldInfo); } foreach (var propertyInfo in ModelType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.GetProperty | BindingFlags.SetProperty)) { var field = propertyInfo.GetCustomAttribute <FieldProviderAttribute>(false); if (field == null) { continue; } InitializeField(field, propertyInfo); } foreach (var field in fields) { if (titleField != null) { throw new InvalidOperationException($"Title field already defined for content type {Name}."); } var titleAttribute = field.Binding.Member.GetCustomAttribute <TitleAttribute>(true); if (titleAttribute != null) { if (!(field is ITextField title)) { throw new InvalidOperationException(); } titleField = title; break; } } }
private void CreateTextBox(ITextField textBox) { Dyn.TypeDescriptor typeDescriptor = Dyn.TypeDescriptor.GetTypeDescriptor(propertyGrid.SelectedObject); Dyn.PropertyDescriptor propertyDescriptor = new Dyn.PropertyDescriptor(propertyGrid.SelectedObject.GetType(), textBox.Symbol, typeof(string), textBox.DefaultValue, new Scm.BrowsableAttribute(true), new Scm.DisplayNameAttribute(textBox.Title), new Scm.DescriptionAttribute(CreatePropertyDescription(textBox)), new Scm.DefaultValueAttribute(textBox.DefaultValue) ); propertyDescriptor.Attributes.Add(new Scm.CategoryAttribute(CATEGORY_USER_INPUT), true); propertyDescriptor.Attributes.Add(new PropertyControlAttribute(ControlTypeEnum.TextBox), true); typeDescriptor.GetProperties().Add(propertyDescriptor); }
private void ProcessFieldList(IList <ITextField> list) { if (RecordType == TextRecordType.FixedLength) { for (int n = 0; n < list.Count; n++) { ITextField field = list[n]; if (SequentialProperties) { if (field.Position == TextField.AutoPosition) { field.Position = RecordLength; } else if (field.Length == 0) { if (list.Count <= (n + 1)) { throw new ArgumentException("Invalid Length in TextField " + n); } var fNext = list[n + 1]; if (fNext.Position <= 0) { throw new ArgumentException("Invalid Length in TextField " + n); } field.Length = fNext.Position - field.Position; } } int testEnd = field.Position + field.Length; RecordLength = Math.Max(RecordLength, testEnd); } } else if (SequentialProperties) { for (int n = 0; n < list.Count; n++) { if ((list[n].Position <= 0) && (n > 0)) { list[n].Position = n; } } } }
static void Main(string[] args) { ISkinFactory skinFactory = (ISkinFactory)AppConfigHelper.GetFactoryInstance("SummerSkinFactory"); if (skinFactory == null) { Console.WriteLine("读取当前选中皮肤类型失败..."); } IButton button = skinFactory.CreateButton(); ITextField textField = skinFactory.CreateTextField(); IComboBox comboBox = skinFactory.CreateComboBox(); button.Display(); textField.Display(); comboBox.Display(); Console.ReadKey(); }
public void CrearAndroid() { factory = new AndroidFactory(); IButton button = factory.CrearButton("Registrarse"); IScrollbar scrollbar = factory.CrearScrollbar(); ITextField textField = factory.CrearTextfield(); Assert.IsTrue(button is ButtonAndroid); Assert.IsTrue(scrollbar is ScrollbarAndroid); Assert.IsTrue(textField is TextFieldAndroid); Assert.AreEqual($"Android: Ejecutando Registrarse.", button.Presionar()); Assert.AreEqual($"Android: Bajando", scrollbar.Bajar()); char letra = 'x'; Assert.AreEqual($"Android: Input <{letra}>", textField.Escribir(letra)); }
public void CrearIOS() { factory = new IOSFactory(); IButton button = factory.CrearButton("Enviar"); IScrollbar scrollbar = factory.CrearScrollbar(); ITextField textField = factory.CrearTextfield(); Assert.IsTrue(button is ButtonIOS); Assert.IsTrue(scrollbar is ScrollbarIOS); Assert.IsTrue(textField is TextFieldIOS); Assert.AreEqual($"IOS: Ejecutando Enviar.", button.Presionar()); Assert.AreEqual($"IOS: Bajando", scrollbar.Bajar()); char letra = 'm'; Assert.AreEqual($"IOS: Input <{letra}>", textField.Escribir(letra)); }
public void CrearWeb() { factory = new WebFactory(); IButton button = factory.CrearButton("Iniciar Sesion"); IScrollbar scrollbar = factory.CrearScrollbar(); ITextField textField = factory.CrearTextfield(); Assert.IsTrue(button is ButtonWeb); Assert.IsTrue(scrollbar is ScrollbarWeb); Assert.IsTrue(textField is TextFieldWeb); Assert.AreEqual($"JavaScript: Ejecutando Iniciar Sesion.", button.Presionar()); Assert.AreEqual($"JavaScript: Bajando", scrollbar.Bajar()); char letra = 'a'; Assert.AreEqual($"JavaScript: Input <{letra}>", textField.Escribir(letra)); }
/* * 抽象工厂与工厂方法最大的区别就在于,工厂方法模式针对的是一个产品等级结构,而抽象工厂模式需要面对多个产品等级结构,一个工厂等级结构可以负责多个不同产品等级中的产品对象的创建。 * * 一个界面皮肤库的实例,多个产品等级结构,如果使用工厂方法模式的,代码就非常多了。 * 增加新的产品等级结构很麻烦,增加新的产品等级结构很麻烦,增加新的产品等级结构很麻烦!!!(重要的事情说三遍)因为需要对原有系统进行较大的修改,甚至需要修改抽象层代码,这必然会带来较大的不便,在这个角度,它违背了开闭(对扩展开放,对修改封闭)原则。 * * 想想,如果我们需要为单选按钮(RadioButton)提供不同皮肤的风格化显示,会发现无论选择哪种皮肤,单选按钮都显得“格格不入”。 * * 抽象工厂角色 * 具体工厂角色 * 抽象产品角色 * 具体产品角色 */ static void Main(string[] args) { Console.WriteLine("Hello World!"); ISkinFactory skinFactory = new SpringSkinFactory(); if (skinFactory == null) { Console.WriteLine("读取当前选中皮肤类型失败..."); } IButton button = skinFactory.CreateButton(); ITextField textField = skinFactory.CreateTextField(); IComboBox comboBox = skinFactory.CreateComboBox(); button.Display(); textField.Display(); comboBox.Display(); Console.ReadKey(); }
private static string GetFieldValue(ITextField field, T obj) { var pi = field.Property; object oValue = pi.GetValue(obj, null); if (oValue == null) { return(string.Empty); } if (oValue is Boolean) { return(field.FormatBoolean((bool)oValue)); } if ((!string.IsNullOrEmpty(field.OutputFormat)) && (oValue is IFormattable)) { return(((IFormattable)oValue).ToString(field.OutputFormat, null)); } return(oValue.ToString()); }
static void Main(string[] args) { SimpleFactory.GetCook(CookName.宫保鸡丁); GBJDFactory gBJDFactory = new GBJDFactory(); gBJDFactory.Cooking(); YXRSFactory yXRSFactory = new YXRSFactory(); yXRSFactory.Cooking(); ISkinFactory skinFactory = new SpringSkinFactory(); IButton button = skinFactory.CreateButton(); ITextField textField = skinFactory.CreateTextField(); IComboBox comboBox = skinFactory.CreateComboBox(); button.Display(); textField.Display(); comboBox.Display(); Console.ReadKey(); }
public ListArray(ICollectionElementDriver driver) { _driver = driver; Input = driver.CreateTextField("input"); }
private void OnEnable() { if (mSerializedObject.IsNull()) { mSerializedObject = new SerializedObject(target); } mRootLayout = new VerticalLayout(); if (mCodeGenerateInfo.Namespace.IsNullOrEmpty()) { mCodeGenerateInfo.Namespace = UIKitSettingData.GetProjectNamespace(); } if (mCodeGenerateInfo.ScriptsFolder.IsNullOrEmpty()) { mCodeGenerateInfo.ScriptsFolder = "Assets" + UIKitSettingData.GetScriptsPath(); } if (mCodeGenerateInfo.ScriptName.IsNullOrEmpty()) { mCodeGenerateInfo.ScriptName = mCodeGenerateInfo.gameObject.name; } new HorizontalLayout() .AddChild(EasyIMGUI.Label().Text(LocaleText.Namespace).Width(150)) .AddChild(EasyIMGUI.TextField().Text(mCodeGenerateInfo.Namespace).Do(v => { v.Content.Bind((newValue) => { mCodeGenerateInfo.Namespace = newValue; EditorUtility.SetDirty(mCodeGenerateInfo); }); })) .AddTo(mRootLayout); new HorizontalLayout() .AddChild(EasyIMGUI.Label().Text(LocaleText.ScriptName)).Width(150) .AddChild(EasyIMGUI.TextField().Text(mCodeGenerateInfo.ScriptName).Do(v => { v.Content.Bind((newValue) => { mCodeGenerateInfo.ScriptName = newValue; EditorUtility.SetDirty(mCodeGenerateInfo); }); })) .AddTo(mRootLayout); new HorizontalLayout() .AddChild(EasyIMGUI.Label().Text(LocaleText.ScriptsFolder).Width(150)) .AddChild(EasyIMGUI.TextField().Text(mCodeGenerateInfo.ScriptsFolder).Do(v => { v.Content.Bind((newValue) => { mCodeGenerateInfo.ScriptsFolder = newValue; EditorUtility.SetDirty(mCodeGenerateInfo); }); mScriptFolderView = v; })) .AddTo(mRootLayout); EasyIMGUI.Custom().OnGUI(() => { EditorGUILayout.Space(); EditorGUILayout.LabelField("请将要生成脚本的文件夹拖到下边区域 或 自行填写目录到上一栏中"); var sfxPathRect = EditorGUILayout.GetControlRect(); sfxPathRect.height = 200; GUI.Box(sfxPathRect, string.Empty); EditorGUILayout.LabelField(string.Empty, GUILayout.Height(185)); if ( Event.current.type == EventType.DragUpdated && sfxPathRect.Contains(Event.current.mousePosition) ) { //改变鼠标的外表 DragAndDrop.visualMode = DragAndDropVisualMode.Generic; if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0) { if (DragAndDrop.paths[0] != "") { var newPath = DragAndDrop.paths[0]; mScriptFolderView.Content.Value = newPath; AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } } var fileFullPath = mCodeGenerateInfo.ScriptsFolder + "/" + mCodeGenerateInfo.ScriptName + ".cs"; if (File.Exists(mCodeGenerateInfo.ScriptsFolder + "/" + mCodeGenerateInfo.ScriptName + ".cs")) { var scriptObject = AssetDatabase.LoadAssetAtPath <MonoScript>(fileFullPath); if (GUILayout.Button("打开脚本", GUILayout.Height(30))) { AssetDatabase.OpenAsset(scriptObject); } if (GUILayout.Button("选择脚本", GUILayout.Height(30))) { Selection.objects = new Object[] { scriptObject }; } } }).AddTo(mRootLayout); EasyIMGUI.Button() .Text(LocaleText.Generate) .OnClick(() => { if (mCodeGenerateInfo.GetComponent <UIDefaultPanel>()) { CreateILBehaviourCode.DoCreateCodeFromScene(mCodeGenerateInfo.gameObject, true); } else { CreateILBehaviourCode.DoCreateCodeFromScene(mCodeGenerateInfo.gameObject); } }) .Height(30) .AddTo(mRootLayout); }
internal Text(Values.Object instance, ITextField field) { Instance = instance; Field = field; }
public CookieTestPage(IBrowserDriver driver) : base(driver) { TextField = driver.CreateTextField().FromID("textField"); Button = driver.CreateButton().FromID("submitButton"); }
public void Run(IBrowser browser) { using (browser) { foreach (Command command in commands) { bool result = false; switch (command.Action) { case "open": { string url = string.Format("{0}{1}.aspx", FairyTalesUrl, command.Subject); browser.GoTo(url); result = browser.Url == url; } break; case "check": { if (command.Subject == "ActiveProject") { ISpan span = browser.Span("ctl00_ContentPlaceHolder1_activeProject"); if (span.Exists) { result = span.Text == command.Argument.Replace("\"", ""); } } } break; case "enter": { if (command.Subject == "ProjectInput") { string input = command.Argument.Replace("\"", ""); ITextField projectInput = browser.TextField("ctl00_ContentPlaceHolder1_projectInput"); if (projectInput.Exists) { projectInput.Value = input; result = projectInput.Value == input; } } } break; case "press": { if (command.Subject == "AddProject") { IButton button = browser.Button("ctl00_ContentPlaceHolder1_addProjectButton"); if (button.Exists) { button.Click(); result = true; } } } break; } results.Add(command.ToString(), result); } } results["close"] = true; }
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 SerialTextField(ITextField wdg) : base(wdg) { _element = wdg; InitializeProperty(); }
public static IHtmlString Render(this ITextField field) { return(Render(field, true)); }
public void Update(ITextField newWdg) { _element = newWdg; base.Update(newWdg); InitializeProperty(); }
public ActualControl(IBrowserDriver driver) : base(driver) { TextField = driver.CreateTextField().FromID("field"); }