public bool ShowDropdown(FieldView view) { //find location //assumption: form size (width and height) already set and they can not be greate than 50% of screen size Point scrPoint = view.Parent.PointToScreen(view.comboLookupFormAnchorPoint()); Rectangle scrRect = Screen.GetWorkingArea(scrPoint); //vertical int h = view.comboLookupFormElementHeight(); if ((scrPoint.Y+h+ Height)>scrRect.Bottom) scrPoint.Y = scrPoint.Y - 1 - Height; else scrPoint.Y = scrPoint.Y + h + 1; //horizontal if ((scrPoint.X + Width) > scrRect.Right) scrPoint.X = scrPoint.X - ((scrPoint.X + Width) - scrRect.Right); if (scrPoint.X < scrRect.Left) scrPoint.X = scrRect.Left; Location = scrPoint; using(Timer tmr = new Timer()) { tmr.Interval = 10;//ms tmr.Tick += tmrTick; try { tmr.Enabled = true; ShowDialog(); } finally { tmr.Enabled = false; tmr.Tick -= tmrTick; //timer bug fix } } return false; }
public PacmanController(PlayingField field, FieldView view) { view.Form.KeyDown += (o, s) => { switch (s.KeyCode) { case Keys.Up: field.Kolobok.Directon = Directon.UP; break; case Keys.Down: field.Kolobok.Directon = Directon.DOWN; break; case Keys.Left: field.Kolobok.Directon = Directon.LEFT; break; case Keys.Right: field.Kolobok.Directon = Directon.RIGHT; break; case Keys.Space: field.Fire(); break; } }; field.GameOver += (o, s) => { view.Form.Timer.Stop(); MessageBox.Show("Game over", "Info"); }; view.Form.Timer.Start(); }
public override void draw() { if (co == null) { return; } base.draw(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label(""); GUILayout.Label("Position"); GUILayout.Label("Rotation"); GUILayout.Label("Scale"); GUILayout.EndVertical(); GUILayout.BeginVertical(); GUILayout.Label("Local"); trans.localPosition = FieldView.displayVector3(trans.localPosition); trans.localRotation = Quaternion.Euler(FieldView.displayVector3(trans.localRotation.eulerAngles)); trans.localScale = FieldView.displayVector3(trans.localScale); GUILayout.EndVertical(); GUILayout.Space(10); GUILayout.BeginVertical(); GUILayout.Label("Absolute"); trans.position = FieldView.displayVector3(trans.position); trans.rotation = Quaternion.Euler(FieldView.displayVector3(trans.rotation.eulerAngles)); trans.localScale = FieldView.displayVector3(trans.localScale); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
public void TestSetDefaultCellSize() { IFieldView v = new FieldView(); Assert.AreEqual <Size>(new Size(30, 30), v.CellSize); }
public ViewPageFieldViewModel(CipherView cipher, FieldView field) { _cipher = cipher; Field = field; ToggleHiddenValueCommand = new Command(ToggleHiddenValue); }
public FieldView AddFieldView(FieldView fieldview) { throw new NotImplementedException(); }
public static bool IsOutOfRange(this FieldView field, Location location) { return(location.X < 0 || location.Y < 0 || location.X >= field.Width || location.Y >= field.Height); }
void ExecuteSendToBottom(object o) { World.Fields.SendToBottom(SelectedField); NotifyPropertyChanged(() => SelectedFieldZOrder); FieldView.RefreshView(); }
public static IEnumerable <IEnumerable <CellType> > RowAccross(this FieldView fields, Location leftTop, Location rightBottom) { return(leftTop.RowRectangleAcross(rightBottom).ToCellsTypes(fields)); }
public UserInput(FieldView _canvasRef) { canvasRef = _canvasRef; }
private void Composer_ErosionStarted(object sender, StatusChangedArgument arg) { FieldView.UpdateProgressBar("Erosion started"); }
private void Composer_LayerDescribed(object sender, StatusChangedArgument arg) { FieldView.UpdateProgressBar("Layers described"); }
private void Composer_MergeStarted(object sender, StatusChangedArgument arg) { FieldView.UpdateProgressBar("Merge process started"); }
private void Composer_RiverGenerationStarted(object sender, StatusChangedArgument arg) { FieldView.UpdateProgressBar("River generation started"); }
public static ViewCell GetNumberCell(FieldView oField) { //Cria o primeiro label a ser exibido Label oLabel = new Label() { Text = oField.Title, VerticalTextAlignment = TextAlignment.Center, }; //cria o componente de entrada de dados Entry oEntry = new Entry() { Placeholder = oField.Detail, Keyboard = Keyboard.Text, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center }; //faz o binding do campo Text com a propriedade Value do oField oEntry.SetBinding(Entry.TextProperty, "Value"); oEntry.BindingContext = oField; //anexa os eventos oEntry.Completed += oField.OnCompletedEvent; oEntry.Unfocused += oField.OnUnfocusedEvent; //se for do tipo numero valida o numero if (oField.FieldType == FieldTypeEnum.Number) { oEntry.Keyboard = Keyboard.Numeric; //seta o valor default configurado Double nAux = 0; var lParseOk = Double.TryParse(oField.ValueDefault, out nAux); if (lParseOk) { oEntry.Text = nAux.ToString(); } }//se for do tipo text seta o texto default else if (oField.FieldType == FieldTypeEnum.Entry) { if (oField.ValueDefault != null) { oEntry.Text = oField.ValueDefault; } } //Cria o ViewCell com todos os componentes internamente ViewCell oViewCell = new ViewCell() { View = new StackLayout() { //define a orientaçao horizontal , para fica um do lado do outro Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Margin = DefaultMargin, //adiciona os filhos ao componente Children = { oLabel, oEntry } } }; return(oViewCell); }
public static ViewCell GetSliderCell(FieldView oField) { //Cria o primeiro label a ser exibido Label oLabel = new Label() { Text = oField.Title, VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center }; Label oLabelValue = new Label() { Text = "", VerticalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center }; //cria o componente de entrada de dados Slider oSlider = new Slider() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center }; double dAux = 0; var lParseOk = double.TryParse(oField.ValueMinimum, out dAux); if (lParseOk) { oSlider.Minimum = dAux; } lParseOk = double.TryParse(oField.ValueMaximum, out dAux); if (lParseOk) { oSlider.Maximum = dAux; } //faz o binding do campo Text com a propriedade Value do oField oSlider.ValueChanged += (sender, e) => { oLabelValue.Text = oSlider.Value.ToString("0"); oField.Value = oLabelValue.Text; }; lParseOk = double.TryParse(oField.ValueDefault, out dAux); if (lParseOk) { oSlider.Value = dAux; } //Cria o ViewCell com todos os componentes internamente ViewCell oViewCell = new ViewCell() { Height = 100, View = new StackLayout() { //define a orientaçao horizontal , para fica um do lado do outro Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Margin = DefaultMargin, //adiciona os filhos ao componente Children = { oLabel, oSlider, oLabelValue } } }; return(oViewCell); }
void ExecuteBringToTop(object o) { World.Fields.BringToTop(SelectedField); NotifyPropertyChanged(() => SelectedFieldZOrder); FieldView.RefreshView(); }
public static IEnumerable <IEnumerable <CellType> > RowAccross(this FieldView fields, Location centre, int radius) { return(centre.RowRectangleAcross(radius).ToCellsTypes(fields)); }
public Field(FieldView obj) { Name = obj.Name; Value = obj.Value; Type = obj.Type; }
public static IEnumerable <IEnumerable <CellType> > ToCellsTypes(this IEnumerable <IEnumerable <Location> > locations, FieldView fields) { return(locations.Select(r => r.Select(l => fields[l]))); }
private void buildFields() { const int hpad = 10; var x = 10; var y = 10; foreach(var fld in Record.Fields) { var view = new FieldView(); view.CaptionPlacement = CaptionPlacement.Left; view.CaptionHIndent = 170; view.BeginInit(); view.AttachToField = fld; this.Controls.Add(view); var width = view.CaptionHIndent + fld.DisplayWidth * 10; if (fld.LookupDictionary.Count>0) { view.ControlType = ControlType.Radio; view.LineCount = fld.LookupDictionary.Count; view.ElementVSpacing = 6; } if (fld is BoolField) view.ControlType = ControlType.Check; view.SetBounds(x, y, width, 0); view.EndInit(); y+=view.Height+hpad; } }//buildFields
public bool TryGetField(Point pos, Direction dir, out FieldView fieldView) { return(_fieldMap.TryGetValue(new PointDir(pos, dir), out fieldView)); }
private void drawDefaultComponent() { GUILayout.TextArea(this.text); if (this.fieldInfo.Length > 0 && GUILayout.Button("Fields", GUILayout.Height(16))) { this.displayField = !this.displayField; } if (displayField) { foreach (System.Reflection.FieldInfo info in fieldInfo) { GUILayout.BeginHorizontal(); GUILayout.Label(info.Name); object value = info.GetValue(this.co); switch (info.FieldType.ToString()) { case "System.Boolean": info.SetValue(this.co, FieldView.displayBool((bool)value)); break; case "UnityEngine.Vector3": info.SetValue(this.co, FieldView.displayVector3((Vector3)value)); break; case "System.Int32": info.SetValue(this.co, FieldView.displayInt((int)value)); break; case "System.Single": info.SetValue(this.co, FieldView.displayFloat((float)value)); break; case "System.Double": info.SetValue(this.co, FieldView.displayDouble((double)value)); break; case "System.String": info.SetValue(this.co, FieldView.displayString((string)value)); break; case "System.Collections.Generic.List`1[System.String]": info.SetValue(this.co, FieldView.displayListString((List <string>)value)); break; default: if (value == null) { GUILayout.Label("null"); } else { GUILayout.Label(value.ToString()); } if (info.FieldType.ToString().Contains("System.Collections.Generic.List`1")) { try { IEnumerable list = (IEnumerable)value; GUILayout.BeginVertical(); foreach (var str in list) { if (str == null) { continue; } GUILayout.Label(str.ToString()); } GUILayout.EndVertical(); } catch { } } break; } GUILayout.EndHorizontal(); } } if (this.propertyInfo.Length > 0 && GUILayout.Button("Props", GUILayout.Height(16))) { this.displayProps = !this.displayProps; } if (displayProps) { foreach (System.Reflection.PropertyInfo info in propertyInfo) { GUILayout.BeginHorizontal(); GUILayout.Label(info.Name); if (!info.CanWrite) { GUILayout.Label(info.PropertyType.ToString()); GUILayout.EndHorizontal(); continue; } object value = info.GetValue(this.co, null); switch (info.PropertyType.ToString()) { case "System.Boolean": info.SetValue(this.co, FieldView.displayBool((bool)value), null); break; case "UnityEngine.Vector3": info.SetValue(this.co, FieldView.displayVector3((Vector3)value), null); break; case "System.Int32": info.SetValue(this.co, FieldView.displayInt((int)value), null); break; case "System.Single": info.SetValue(this.co, FieldView.displayFloat((float)value), null); break; case "System.Double": info.SetValue(this.co, FieldView.displayDouble((double)value), null); break; case "System.String": info.SetValue(this.co, FieldView.displayString((string)value), null); break; case "System.Collections.Generic.List`1[System.String]": info.SetValue(this.co, FieldView.displayListString((List <string>)value), null); break; default: if (value == null) { GUILayout.Label("null"); } else { GUILayout.Label(value.ToString()); } break; } GUILayout.EndHorizontal(); } } if (GUILayout.Button("Methods", GUILayout.Height(16))) { this.displayMethod = !this.displayMethod; } if (displayMethod) { GUILayout.TextArea(this.methods); } }
public void Add(Point pos, Direction dir, FieldView fieldView) { _fieldMap.Add(new PointDir(pos, dir), fieldView); }
public ViewPageFieldViewModel(FieldView field) { Field = field; ToggleHiddenValueCommand = new Command(ToggleHiddenValue); }
void ExecuteSplit(object o) { CurrentPolygon.SplitSelected(); FieldView.RefreshView(); }
public FieldView UpdateFieldView(FieldView fieldView) { throw new NotImplementedException(); }
void ExecuteMerge(object o) { CurrentPolygon.MergeSelected(); FieldView.RefreshView(); }
public void TestInstantiateNoError() { IFieldView _ = new FieldView(); }
bool CanExecuteTranslate(object o) { return(CurrentPolygon != null && CurrentPolygon.HasSelectedPoints && FieldView.IsFieldViewSelected()); }
public FieldController(DefaultMessageBus messageDispatcher, FieldView fieldView, CategoryView categoryView) { _messageDispatcher = messageDispatcher; _fieldView = fieldView; _categoryView = categoryView; }
public static ViewCell GetDatePickerCell(FieldView oField) { //Cria o primeiro label a ser exibido Label oLabel = new Label() { Text = oField.Title, VerticalTextAlignment = TextAlignment.Center, }; //cria o componente de data DatePicker oDatePicker = new DatePicker() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center }; DateTime dDate = new DateTime(); var lParseOk = DateTime.TryParse(oField.ValueMinimum, out dDate); if (lParseOk) { oDatePicker.MinimumDate = dDate; } lParseOk = DateTime.TryParse(oField.ValueMaximum, out dDate); if (lParseOk) { oDatePicker.MaximumDate = dDate; } //faz o binding do campo Text com a propriedade Value do oField oDatePicker.DateSelected += (sender, e) => { oField.Value = oDatePicker.Date.ToString(); }; //anexa os eventos oDatePicker.Unfocused += oField.OnUnfocusedEvent; //seta o valor default lParseOk = DateTime.TryParse(oField.ValueDefault, out dDate); if (lParseOk) { oDatePicker.Date = dDate; } //Cria o ViewCell com todos os componentes internamente ViewCell oViewCell = new ViewCell() { View = new StackLayout() { //define a orientaçao horizontal , para fica um do lado do outro Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Margin = DefaultMargin, //adiciona os filhos ao componente Children = { oLabel, oDatePicker } } }; return(oViewCell); }