internal void InsertData(string data, int sec, ChoiceField field) { IWebElement input = Input(sec, ref field); input.Click(); input.SendKeys(Keys.Home); input.SendKeys(data + Keys.Enter); }
GObjPickupInterface UnityPlayerInterface.NewGObjChoiceField(GObjPickupListener listener) { var field = new ChoiceField { listener = listener, parent = this }; choiceFields.Add(field); return(field); }
public void ChoicesTest() { ChoiceField target = new ChoiceField { Choices = MvcForms.Widgets.Choices.AustralianStates.Abbreviated }; Assert.AreSame(target.Choices, MvcForms.Widgets.Choices.AustralianStates.Abbreviated); }
public void ValidValueTest() { ChoiceField target = new ChoiceField { Choices = MvcForms.Widgets.Choices.AustralianStates.Abbreviated }; Assert.IsTrue(target.ValidValue("QLD")); Assert.IsFalse(target.ValidValue("CA")); }
public void DefaultLabelTest() { ChoiceField target = new ChoiceField(); target.DefaultLabel = "Test1"; Assert.AreEqual("Test1", target.Widget.DefaultLabel); target.Widget.DefaultLabel = "Test2"; Assert.AreEqual("Test2", target.DefaultLabel); }
internal IWebElement Input(int sec, ref ChoiceField field) { try { return(AllElemContainText(ref _drv, "*", "Р", rsp[field])); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
public void ShowDefaultTest() { ChoiceField target = new ChoiceField(); target.ShowDefault = false; Assert.IsFalse(target.Widget.ShowDefault); target.ShowDefault = true; Assert.IsTrue(target.Widget.ShowDefault); target.Widget.ShowDefault = false; Assert.IsFalse(target.ShowDefault); target.Widget.ShowDefault = true; Assert.IsTrue(target.ShowDefault); }
public IntAttributeEditor(string name, MapEditorState state, int minValue, int maxValue, ref int currentY) : base(name, state, ref currentY) { State.ChoiceFields.Add("editor-" + GetType().Name + "-" + Name, ChoiceField = new ChoiceField() { Game = state.Game, Label = name + ": ", // https://stackoverflow.com/questions/4138454/elegant-way-to-transform-arrays-in-c Choices = null, Choice = minValue, MinValue = minValue, MaxValue = maxValue, Position = new TweenedVector2(state.Game, new Vector2(state.Game.GraphicsDevice.Viewport.Bounds.Width / 2 - 400 / 2, currentY)), Font = state.Game.DefaultFonts.Bold, Width = 400 }); currentY += ChoiceField.Rectangle.Height + 4; }
public EnumAttributeEditor(string name, MapEditorState state, ref int currentY) : base(name, state, ref currentY) { Values = Enum.GetValues(typeof(T)).Cast <T>().ToList(); State.ChoiceFields.Add("editor-" + GetType().Name + "-" + Name, ChoiceField = new ChoiceField() { Game = state.Game, Label = name + ": ", // https://stackoverflow.com/questions/4138454/elegant-way-to-transform-arrays-in-c Choices = Values.Select(e => e.ToString()).ToArray(), Choice = 0, Position = new TweenedVector2(state.Game, new Vector2(state.Game.GraphicsDevice.Viewport.Bounds.Width / 2 - 400 / 2, currentY)), Font = state.Game.DefaultFonts.Bold, Width = 400 }); currentY += ChoiceField.Rectangle.Height + 4; }
public void CleanTest() { ChoiceField target = new ChoiceField { Choices = MvcForms.Widgets.Choices.AustralianStates.Abbreviated }; AssertExtras.Raises <ValidationException>(delegate() { target.Clean(null); }).WithMessage("This field is required."); target.Required = false; Assert.IsNull(target.Clean(null)); Assert.AreEqual("QLD", target.Clean("QLD")); AssertExtras.Raises <ValidationException>(delegate() { target.Clean("CA"); }); }
internal override Annotation Clone(IDocumentEssential owner, Page page) { if (Page == null) { ApplyOwner(owner); SetPage(page, true); return(this); } PDFDictionary res = AnnotationBase.Copy(Dictionary); Field.CopyTo(Dictionary, res); ChoiceField.Copy(Dictionary, res); ComboBox annot = new ComboBox(res, owner); annot.SetPage(Page, false); annot.SetPage(page, true); annot.SetTextProperties(Font, FontColor); Field.SetActions(this, annot); return(annot); }
void BuildUI() { var b = View.Bounds; var statusHeight = 22.0f; // // Account Field // var fieldHeight = 33; accountField = new ChoiceField( #if !__UNIFIED__ new RectangleF(0, b.Y, b.Width, 33), #else new RectangleF(0, (float)b.Y, (float)b.Width, 33), #endif this, NSBundle.MainBundle.LocalizedString("From", "From title when sharing")); View.AddSubview(accountField); b.Y += fieldHeight; b.Height -= fieldHeight; // // Text Editor // var editorHeight = b.Height; if (service.HasMaxTextLength || item.Links.Count > 0) { editorHeight -= statusHeight; } textEditor = new UITextView( #if !__UNIFIED__ new RectangleF(0, b.Y, b.Width, editorHeight)) #else new RectangleF(0, (float)b.Y, (float)b.Width, (float)editorHeight)) #endif { Font = TextEditorFont, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, Text = item.Text, }; textEditor.Delegate = new TextEditorDelegate(this); View.AddSubview(textEditor); // // Icons // if (item.Images.Count > 0) { var rem = 4.0f; RectangleF f; var x = b.Right - AttachmentIcon.Size - 8 - rem * (item.Images.Count - 1); var y = textEditor.Frame.Y + 8; #if !__UNIFIED__ f = textEditor.Frame; f.Width = x - 8 - f.X; #else f = (RectangleF)textEditor.Frame; f.Width = (float)x - 8 - f.X; #endif textEditor.Frame = f; foreach (var i in item.Images) { var icon = new ImageIcon(i.Image); #if !__UNIFIED__ f = icon.Frame; f.X = x; f.Y = y; #else f = (RectangleF)icon.Frame; f.X = (float)x; f.Y = (float)y; #endif icon.Frame = f; View.AddSubview(icon); x += rem; y += rem; } } // // Remaining Text Length // if (service.HasMaxTextLength) { textLengthLabel = new TextLengthLabel( #if !__UNIFIED__ new RectangleF(4, b.Bottom - statusHeight, textEditor.Frame.Width - 8, statusHeight), #else new RectangleF(4, (float)(b.Bottom - statusHeight), (float)(textEditor.Frame.Width - 8), statusHeight), #endif service.MaxTextLength) { TextLength = service.GetTextLength(item), }; View.AddSubview(textLengthLabel); } // // Links Label // if (item.Links.Count > 0) { linksLabel = new UILabel( #if !__UNIFIED__ new RectangleF(4, b.Bottom - statusHeight, textEditor.Frame.Width - 66, statusHeight)) { #else new RectangleF(4, (float)(b.Bottom - statusHeight), (float)(textEditor.Frame.Width - 66), statusHeight)) { #endif TextColor = UIColor.FromRGB(124, 124, 124), AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth, UserInteractionEnabled = false, BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(16), LineBreakMode = UILineBreakMode.HeadTruncation, }; if (item.Links.Count == 1) { linksLabel.Text = item.Links[0].AbsoluteUri; } else { linksLabel.Text = string.Format( NSBundle.MainBundle.LocalizedString("{0} links", "# of links label"), item.Links.Count); } View.AddSubview(linksLabel); } // // Navigation Items // NavigationItem.LeftBarButtonItem = new UIBarButtonItem( UIBarButtonSystemItem.Cancel, delegate { completionHandler(ShareResult.Cancelled); }); NavigationItem.RightBarButtonItem = new UIBarButtonItem( NSBundle.MainBundle.LocalizedString("Send", "Send button text when sharing"), UIBarButtonItemStyle.Done, HandleSend); // // Watch for the keyboard // NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, HandleKeyboardDidHide); } void HandleSend(object sender, EventArgs e) { if (sharing) { return; } item.Text = textEditor.Text; StartSharing(); var account = accounts.FirstOrDefault(); if (accounts.Count > 1 && accountField != null) { account = accounts.FirstOrDefault(x => x.Username == accountField.SelectedItem); } try { service.ShareItemAsync(item, account).ContinueWith(shareTask => { StopSharing(); if (shareTask.IsFaulted) { this.ShowError("Share Error", shareTask.Exception); } else { completionHandler(ShareResult.Done); } }, TaskScheduler.FromCurrentSynchronizationContext()); } catch (Exception ex) { StopSharing(); this.ShowError("Share Error", ex); } } void StartSharing() { sharing = true; NavigationItem.RightBarButtonItem.Enabled = false; if (progress == null) { progress = new ProgressLabel(NSBundle.MainBundle.LocalizedString("Sending...", "Sending... status message when sharing")); NavigationItem.TitleView = progress; progress.StartAnimating(); } } void StopSharing() { sharing = false; NavigationItem.RightBarButtonItem.Enabled = true; if (progress != null) { progress.StopAnimating(); NavigationItem.TitleView = null; progress = null; } }
void BuildUI () { var b = View.Bounds; var statusHeight = 22.0f; // // Account Field // var fieldHeight = 33; accountField = new ChoiceField ( new RectangleF (0, b.Y, b.Width, 33), this, NSBundle.MainBundle.LocalizedString ("From", "From title when sharing")); View.AddSubview (accountField); b.Y += fieldHeight; b.Height -= fieldHeight; // // Text Editor // var editorHeight = b.Height; if (service.HasMaxTextLength || item.Links.Count > 0) { editorHeight -= statusHeight; } textEditor = new UITextView (new RectangleF (0, b.Y, b.Width, editorHeight)) { Font = TextEditorFont, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, Text = item.Text, }; textEditor.Delegate = new TextEditorDelegate (this); View.AddSubview (textEditor); // // Icons // if (item.Images.Count > 0) { var rem = 4.0f; RectangleF f; var x = b.Right - AttachmentIcon.Size - 8 - rem*(item.Images.Count - 1); var y = textEditor.Frame.Y + 8; f = textEditor.Frame; f.Width = x - 8 - f.X; textEditor.Frame = f; foreach (var i in item.Images) { var icon = new ImageIcon (i.Image); f = icon.Frame; f.X = x; f.Y = y; icon.Frame = f; View.AddSubview (icon); x += rem; y += rem; } } // // Remaining Text Length // if (service.HasMaxTextLength) { textLengthLabel = new TextLengthLabel ( new RectangleF (4, b.Bottom - statusHeight, textEditor.Frame.Width - 8, statusHeight), service.MaxTextLength) { TextLength = service.GetTextLength (item), }; View.AddSubview (textLengthLabel); } // // Links Label // if (item.Links.Count > 0) { linksLabel = new UILabel ( new RectangleF (4, b.Bottom - statusHeight, textEditor.Frame.Width - 66, statusHeight)) { TextColor = UIColor.FromRGB (124, 124, 124), AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth, UserInteractionEnabled = false, BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize (16), LineBreakMode = UILineBreakMode.HeadTruncation, }; if (item.Links.Count == 1) { linksLabel.Text = item.Links[0].AbsoluteUri; } else { linksLabel.Text = string.Format ( NSBundle.MainBundle.LocalizedString ("{0} links", "# of links label"), item.Links.Count); } View.AddSubview (linksLabel); } // // Navigation Items // NavigationItem.LeftBarButtonItem = new UIBarButtonItem ( UIBarButtonSystemItem.Cancel, delegate { completionHandler (ShareResult.Cancelled); }); NavigationItem.RightBarButtonItem = new UIBarButtonItem ( NSBundle.MainBundle.LocalizedString ("Send", "Send button text when sharing"), UIBarButtonItemStyle.Done, HandleSend); // // Watch for the keyboard // NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, HandleKeyboardDidShow); NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, HandleKeyboardDidHide); }
public void ChoiceFieldConstructorTest() { ChoiceField target = new ChoiceField(new MvcForms.Widgets.SelectMultiple()); Assert.IsInstanceOfType(target.Widget, typeof(MvcForms.Widgets.SelectMultiple)); }
void BuildUI() { var b = View.Bounds; var statusHeight = 22.0f; // // Account Field // var fieldHeight = 33; accountField = new ChoiceField( new RectangleF(0, b.Y, b.Width, 33), this, NSBundle.MainBundle.LocalizedString("From", "From title when sharing")); View.AddSubview(accountField); b.Y += fieldHeight; b.Height -= fieldHeight; // // Text Editor // var editorHeight = b.Height; if (service.HasMaxTextLength || item.Links.Count > 0) { editorHeight -= statusHeight; } textEditor = new UITextView(new RectangleF(0, b.Y, b.Width, editorHeight)) { Font = TextEditorFont, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, Text = item.Text, }; textEditor.Delegate = new TextEditorDelegate(this); View.AddSubview(textEditor); // // Icons // if (item.Images.Count > 0) { var rem = 4.0f; RectangleF f; var x = b.Right - AttachmentIcon.Size - 8 - rem * (item.Images.Count - 1); var y = textEditor.Frame.Y + 8; f = textEditor.Frame; f.Width = x - 8 - f.X; textEditor.Frame = f; foreach (var i in item.Images) { var icon = new ImageIcon(i.Image); f = icon.Frame; f.X = x; f.Y = y; icon.Frame = f; View.AddSubview(icon); x += rem; y += rem; } } // // Remaining Text Length // if (service.HasMaxTextLength) { textLengthLabel = new TextLengthLabel( new RectangleF(4, b.Bottom - statusHeight, textEditor.Frame.Width - 8, statusHeight), service.MaxTextLength) { TextLength = service.GetTextLength(item), }; View.AddSubview(textLengthLabel); } // // Links Label // if (item.Links.Count > 0) { linksLabel = new UILabel( new RectangleF(4, b.Bottom - statusHeight, textEditor.Frame.Width - 66, statusHeight)) { TextColor = UIColor.FromRGB(124, 124, 124), AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth, UserInteractionEnabled = false, BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(16), LineBreakMode = UILineBreakMode.HeadTruncation, }; if (item.Links.Count == 1) { linksLabel.Text = item.Links[0].AbsoluteUri; } else { linksLabel.Text = string.Format( NSBundle.MainBundle.LocalizedString("{0} links", "# of links label"), item.Links.Count); } View.AddSubview(linksLabel); } // // Navigation Items // NavigationItem.LeftBarButtonItem = new UIBarButtonItem( UIBarButtonSystemItem.Cancel, delegate { completionHandler(ShareResult.Cancelled); }); NavigationItem.RightBarButtonItem = new UIBarButtonItem( NSBundle.MainBundle.LocalizedString("Send", "Send button text when sharing"), UIBarButtonItemStyle.Done, HandleSend); // // Watch for the keyboard // NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow); NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, HandleKeyboardDidHide); }
public void WidgetTest() { ChoiceField target = new ChoiceField(); Assert.IsInstanceOfType(target.Widget, typeof(MvcForms.Widgets.Select)); }
void BuildUI () { var b = View.Bounds; var statusHeight = 22.0f; // // Account Field // var fieldHeight = 33; accountField = new ChoiceField ( #if ! __UNIFIED__ new RectangleF (0, b.Y, b.Width, 33), #else new RectangleF (0, (float)b.Y, (float)b.Width, 33), #endif this, NSBundle.MainBundle.LocalizedString ("From", "From title when sharing")); View.AddSubview (accountField); b.Y += fieldHeight; b.Height -= fieldHeight; // // Text Editor // var editorHeight = b.Height; if (service.HasMaxTextLength || item.Links.Count > 0) { editorHeight -= statusHeight; } textEditor = new UITextView ( #if ! __UNIFIED__ new RectangleF (0, b.Y, b.Width, editorHeight)) #else new RectangleF (0, (float) b.Y, (float) b.Width, (float)editorHeight)) #endif { Font = TextEditorFont, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, Text = item.Text, }; textEditor.Delegate = new TextEditorDelegate (this); View.AddSubview (textEditor); // // Icons // if (item.Images.Count > 0) { var rem = 4.0f; RectangleF f; var x = b.Right - AttachmentIcon.Size - 8 - rem*(item.Images.Count - 1); var y = textEditor.Frame.Y + 8; #if ! __UNIFIED__ f = textEditor.Frame; f.Width = x - 8 - f.X; #else f = (RectangleF)textEditor.Frame; f.Width = (float)x - 8 - f.X; #endif textEditor.Frame = f; foreach (var i in item.Images) { var icon = new ImageIcon (i.Image); #if ! __UNIFIED__ f = icon.Frame; f.X = x; f.Y = y; #else f = (RectangleF) icon.Frame; f.X = (float)x; f.Y = (float)y; #endif icon.Frame = f; View.AddSubview (icon); x += rem; y += rem; } } // // Remaining Text Length // if (service.HasMaxTextLength) { textLengthLabel = new TextLengthLabel ( #if ! __UNIFIED__ new RectangleF (4, b.Bottom - statusHeight, textEditor.Frame.Width - 8, statusHeight), #else new RectangleF (4, (float)(b.Bottom - statusHeight), (float)(textEditor.Frame.Width - 8), statusHeight), #endif service.MaxTextLength) { TextLength = service.GetTextLength (item), }; View.AddSubview (textLengthLabel); } // // Links Label // if (item.Links.Count > 0) { linksLabel = new UILabel ( #if ! __UNIFIED__ new RectangleF (4, b.Bottom - statusHeight, textEditor.Frame.Width - 66, statusHeight)) { #else new RectangleF (4, (float)(b.Bottom - statusHeight), (float)(textEditor.Frame.Width - 66), statusHeight)) { #endif TextColor = UIColor.FromRGB (124, 124, 124), AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth, UserInteractionEnabled = false, BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize (16), LineBreakMode = UILineBreakMode.HeadTruncation, }; if (item.Links.Count == 1) { linksLabel.Text = item.Links[0].AbsoluteUri; } else { linksLabel.Text = string.Format ( NSBundle.MainBundle.LocalizedString ("{0} links", "# of links label"), item.Links.Count); } View.AddSubview (linksLabel); } // // Navigation Items // NavigationItem.LeftBarButtonItem = new UIBarButtonItem ( UIBarButtonSystemItem.Cancel, delegate { completionHandler (ShareResult.Cancelled); }); NavigationItem.RightBarButtonItem = new UIBarButtonItem ( NSBundle.MainBundle.LocalizedString ("Send", "Send button text when sharing"), UIBarButtonItemStyle.Done, HandleSend); // // Watch for the keyboard // NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, HandleKeyboardDidShow); NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, HandleKeyboardDidHide); } void HandleSend (object sender, EventArgs e) { if (sharing) return; item.Text = textEditor.Text; StartSharing (); var account = accounts.FirstOrDefault (); if (accounts.Count > 1 && accountField != null) { account = accounts.FirstOrDefault (x => x.Username == accountField.SelectedItem); } try { service.ShareItemAsync (item, account).ContinueWith (shareTask => { StopSharing (); if (shareTask.IsFaulted) { this.ShowError ("Share Error", shareTask.Exception); } else { completionHandler (ShareResult.Done); } }, TaskScheduler.FromCurrentSynchronizationContext ()); } catch (Exception ex) { StopSharing (); this.ShowError ("Share Error", ex); } } void StartSharing () { sharing = true; NavigationItem.RightBarButtonItem.Enabled = false; if (progress == null) { progress = new ProgressLabel (NSBundle.MainBundle.LocalizedString ("Sending...", "Sending... status message when sharing")); NavigationItem.TitleView = progress; progress.StartAnimating (); } } void StopSharing () { sharing = false; NavigationItem.RightBarButtonItem.Enabled = true; if (progress != null) { progress.StopAnimating (); NavigationItem.TitleView = null; progress = null; } }
public void ChoiceFieldConstructorTest1() { ChoiceField target = new ChoiceField(); // Assume ok if no exception thrown }