public bool PrepareCellForEdit(FlexGrid sender, GridPanel panel, CellRange range) { FlexGrid g = (FlexGrid)View.ViewWithTag(1); nuint i = (nuint)range.Col; Column col = g.Columns.GetItem <Column>(i); if (col.Binding == "Hired") { UITextField editor = (UITextField)g.ActiveEditor; UIDatePicker picker = new UIDatePicker(); NSDate d = (NSDate)g.GetCellData(range.Row, range.Col, false); picker.Opaque = true; picker.Mode = UIDatePickerMode.Date; picker.Date = d; picker.ValueChanged += picker_ValueChanged; editor.InputView = picker; UIToolbar toolbar = new UIToolbar(new CoreGraphics.CGRect(0, 0, View.Bounds.Width, 44)); toolbar.BarStyle = UIBarStyle.Default; picker.EditingDidEnd += picker_EditingDidEnd; UIBarButtonItem done = new UIBarButtonItem(UIBarButtonSystemItem.Done, picker_EditingDidEnd); UIBarButtonItem space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null); toolbar.SetItems(new UIBarButtonItem[2] { space, done }, false); editor.InputAccessoryView = toolbar; editor.ClearButtonMode = UITextFieldViewMode.Never; } return(false); }
public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); FlexGrid g = (FlexGrid)View.ViewWithTag(1); g.Frame = new CoreGraphics.CGRect(0, 44, View.Bounds.Width, View.Bounds.Height - 44); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. XuniLicenseManager.Key = License.Key; FlexGrid grid = new FlexGrid(); grid.Tag = 1; grid.ItemsSource = Customer.GetCustomerList(50); grid.WeakDelegate = this; Column c1 = ColumnByBinding(grid, "Money"); c1.Format = "c"; Column c2 = ColumnByBinding(grid, "Hired"); c2.Format = "MM/dd/yyyy"; grid.HeadersVisibility = FlexHeadersVisibility.FlexHeadersVisibilityColumn; if (UserInterfaceIdiomIsPhone == false) { starSizingForEditing(grid); } View.AddSubview(grid); }
public static async Task ShowAsync(INavigation navigation, FlexGrid grid) { var form = new ColumnLayoutForm(); form._grid = grid; form._completion = new TaskCompletionSource <bool>(); var columns = new ObservableCollection <ColumnLayoutItemViewModel>(); foreach (var column in grid.Columns) { columns.Add(new ColumnLayoutItemViewModel(columns, column)); } form.BindingContext = columns; await navigation.PushModalAsync(form, true); try { await form._completion.Task; for (int i = 0; i < columns.Count; i++) { var cvm = columns[i]; var currentIndex = grid.Columns.IndexOf(cvm.Column); if (currentIndex != i) { grid.Columns.Move(currentIndex, i); } if (cvm.IsVisible != cvm.Column.IsVisible) { cvm.Column.IsVisible = cvm.IsVisible; } } } catch { } }
public P_CZ_ME_MAP_PARTNER() { InitializeComponent(); MainGrids = new FlexGrid[] { _flexM_T1 }; _flexM_T1.DetailGrids = new FlexGrid[] { _flexD_T1 }; }
void picker_EditingDidEnd(object sender, EventArgs e) { FlexGrid g = (FlexGrid)View.ViewWithTag(1); UITextField editor = (UITextField)g.ActiveEditor; UIDatePicker picker = (UIDatePicker)editor.InputView; g.Cells.SetCellData(picker.Date, g.EditRange.Row, g.EditRange.Col); g.FinishEditing(true); }
private void starSizingForEditing(FlexGrid g) { for (nuint i = 0; i < g.Columns.Count; i++) { Column col = g.Columns.GetItem <Column>(i); col.WidthType = FlexColumnWidth.FlexColumnWidthStar; col.Width = (i == 1) ? 4 : (i == 0) ? 2 : 3; } }
void OnDateSet(object sender, DatePickerDialog.DateSetEventArgs e) { Customer customer = (Customer)editRow.DataItem; customer.Hired = e.Date; FlexGrid.FinishEditing(false); FlexGrid.Refresh(false); }
private void btnSearch_Click(object sender, EventArgs e) { try { FlexGrid.Rows.Count = 1; if (!DataSearchIsValid()) { return; } var searchStyle = new SearchStyleEnum(); switch (cboSearchType.Text) { case "Contains": searchStyle = SearchStyleEnum.Contains; break; case "Starts With": searchStyle = SearchStyleEnum.StartsWith; break; case "Ends With": searchStyle = SearchStyleEnum.EndsWith; break; } var reader = new DeductionDataReader(); var items = reader.SearchItem(txtSearch.Text, searchStyle); var deductions = items as IList <Deduction> ?? items.ToList(); if (!deductions.Any()) { MessageDialog.ShowValidationError(txtSearch, "No items match your search"); return; } FlexGrid.Rows.Count = deductions.Count() + 1; var row = 0; foreach (var item in deductions.OrderBy(_ => _.Description)) { row++; FlexGrid[row, "code"] = item.Code; FlexGrid[row, "description"] = item.Description; FlexGrid.Select(1, 0); } FlexGrid.Focus(); } catch (Exception ex) { MessageDialog.ShowError(ex, this); } }
private void picker_ValueChanged(object sender, EventArgs e) { FlexGrid g = (FlexGrid)View.ViewWithTag(1); UITextField editor = (UITextField)g.ActiveEditor; Column col = g.Columns.GetItem <Column>((nuint)g.EditRange.Col); NSDateFormatter df = new NSDateFormatter(); df.DateFormat = "M/dd/yy"; editor.Text = df.ToString(((UIDatePicker)(sender)).Date); }
private void btnSearch_Click(object sender, EventArgs e) { FlexGrid.Rows.Count = 1; if (!DataSearchIsValid()) { return; } var searchStyle = new SearchStyleEnum(); switch (cboSearchType.Text) { case "Contains": searchStyle = SearchStyleEnum.Contains; break; case "Starts With": searchStyle = SearchStyleEnum.StartsWith; break; case "Ends With": searchStyle = SearchStyleEnum.EndsWith; break; } var reader = new PersonDataReader(); var items = reader.SearchItem(txtSearch.Text, searchStyle); var enumerable = items as IList <Person> ?? items.ToList(); if (!enumerable.Any()) { MessageDialog.ShowValidationError(txtSearch, "No items match your search"); return; } FlexGrid.Rows.Count = enumerable.Count() + 1; var row = 0; foreach (var item in enumerable.OrderBy(_ => _.Name.Fullname)) { row++; FlexGrid[row, "contactid"] = item.Id; FlexGrid[row, "name"] = item.Name.Fullname; FlexGrid[row, "gender"] = item.Gender == GenderType.Male ? "Male" : "Female"; FlexGrid[row, "birthdate"] = item.BirthDate.ToString("yyyy MMM dd"); FlexGrid.Select(1, 0); } FlexGrid.Focus(); }
private async Task <string> SerializeLayout(FlexGrid grid) { var columns = new List <ColumnInfo>(); foreach (var col in grid.Columns) { var colInfo = new ColumnInfo { Name = col.Binding, IsVisible = col.IsVisible }; columns.Add(colInfo); } return(await SerializeLayout(columns.ToArray())); }
private void tab거래처_SelectedIndexChanged(object sender, EventArgs e) { tab_index = tab거래처.SelectedIndex.ToString(); switch (tab거래처.SelectedIndex.ToString()) { case "0": txt명.Enabled = false; 조회조건체크(true); MainGrids = new FlexGrid[] { _flexM_T1 }; _flexM_T1.DetailGrids = new FlexGrid[] { _flexD_T1 }; SetToolBarButtonState(true, false, true, false, true); break; case "1": lbl명.Text = "매체명"; txt명.Enabled = true; 조회조건체크(false); MainGrids = new FlexGrid[] { _flexM_T2 }; SetToolBarButtonState(true, false, false, false, true); break; case "2": lbl명.Text = "대행사명"; txt명.Enabled = true; 조회조건체크(false); SetToolBarButtonState(true, false, false, false, true); break; case "3": lbl명.Text = "렙사명"; txt명.Enabled = true; 조회조건체크(false); SetToolBarButtonState(true, false, false, false, true); break; case "4": lbl명.Text = "광고주명"; txt명.Enabled = true; 조회조건체크(false); SetToolBarButtonState(true, false, false, false, true); break; } }
public Column ColumnByBinding(FlexGrid grid, string binding) { for (nuint i = 0; i < grid.Columns.Count; i++) { Column col = grid.Columns.GetItem <Column> (i); if (col.Binding == binding) { return(col); } } return(null); }
public ColumnLayoutForm(FlexGrid grid) { InitializeComponent(); _grid = grid; btnOK.Content = AppResources.OK; btnCancel.Content = AppResources.Cancel; foreach (var column in _grid.Columns) { _columns.Add(new ColumnLayoutItemViewModel(_columns, column)); } DataContext = _columns; UpdateColumns(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.GettingStarted); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.ExportTitle); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); grid = FindViewById <FlexGrid>(Resource.Id.Grid); grid.ItemsSource = Customer.GetCustomerList(100); grid.ZoomMode = GridZoomMode.Disabled; }
private void DeserializeLayout(FlexGrid grid, string layout) { var columns = DeserializeLayout(layout); for (int i = 0; i < columns.Length; i++) { var colInfo = columns[i]; var column = grid.Columns[colInfo.Name]; var colIndex = grid.Columns.IndexOf(column); column.IsVisible = colInfo.IsVisible; if (colIndex != i) { grid.Columns.Move(colIndex, i); } } }
private void FlexGrid_SelectionChanged(object sender, C1.WPF.FlexGrid.CellRangeEventArgs e) { if (!Double.IsNaN(FlexGrid.Width)) { var size = new System.Windows.Size(FlexGrid.Width, FlexGrid.Height); FlexGrid.Measure(size); FlexGrid.Arrange(new Rect(size)); // RenderTargetBitmapでFlexGridをBitMapに変換する var renderBitmap = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96.0d, 96.0d, PixelFormats.Pbgra32); renderBitmap.Render(FlexGrid); // Imageコントロールに表示する // C1PDFやC1Wordを利用して保存することも可能 image.Source = BitmapFrame.Create(renderBitmap); } }
/* MakeGrid, makes an instance of the GridPrefab and fills * it with icons made from the given list of collections * * @param collections, to make icons. * * @return the new grid's gameObject */ GameObject MakeGrid(List <Collection> collections) { if (collections == null) { return(null); } // Load first icon GameObject GridGO = Instantiate(GridPrefab); FlexGrid grid = GridGO.GetComponent <FlexGrid>(); foreach (Collection collection in collections) { grid.AddElement(MakeIcon(collection)); } return(GridGO); }
private void DeserializeLayout(FlexGrid grid, string layout) { var serializer = new DataContractJsonSerializer(typeof(ColumnInfo[])); var stream = new MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(layout)); var columns = serializer.ReadObject(stream) as ColumnInfo[]; for (int i = 0; i < columns.Length; i++) { var colInfo = columns[i]; var column = grid.Columns[colInfo.Name]; var colIndex = grid.Columns.IndexOf(column); column.IsVisible = colInfo.IsVisible; if (colIndex != i) { grid.Columns.Move(colIndex, i); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CustomSortIcon); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.CustomSortIcon); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); var positionModes = FindViewById <Spinner>(Resource.Id.SortIconPosition); var iconModes = FindViewById <Spinner>(Resource.Id.SortIconTemplate); var positionItems = new GridSortIconPosition[] { GridSortIconPosition.Left, GridSortIconPosition.Inline, GridSortIconPosition.Right }; var positonAdapteritems = new List <string>(); foreach (var value in Enum.GetValues(typeof(GridSortIconPosition))) { positonAdapteritems.Add(value.ToString()); } positionModes.Adapter = new ArrayAdapter(BaseContext, global::Android.Resource.Layout.SimpleSpinnerItem, positonAdapteritems); positionModes.ItemSelected += (s, e) => { grid.SortIconPosition = positionItems[positionModes.SelectedItemPosition]; }; positionModes.SetSelection(0, false); var iconItems = new C1IconTemplate[] { C1IconTemplate.TriangleNorth, C1IconTemplate.ChevronUp, C1IconTemplate.ArrowUp }; var iconAdapterItems = new List <string>(); foreach (var value in new string[] { nameof(C1IconTemplate.TriangleNorth), nameof(C1IconTemplate.ChevronUp), nameof(C1IconTemplate.ArrowUp) }) { iconAdapterItems.Add(value); } iconModes.Adapter = new ArrayAdapter(BaseContext, global::Android.Resource.Layout.SimpleSpinnerItem, iconAdapterItems); iconModes.ItemSelected += (s, e) => { grid.SortAscendingIconTemplate = iconItems[iconModes.SelectedItemPosition]; }; iconModes.SetSelection(0, false); grid = FindViewById <FlexGrid>(Resource.Id.Grid); LoadData(); }
/// <summary> /// /// </summary> private void DefaultGridSetting(ref FlexGrid flexGrid, string charCode) { try { var characteristics = CharacteristicValues.Where(c => c.CharCode == charCode && c.CharStatus != "Deleted").ToList(); characteristics.RemoveAll(a => a.CharValue == "" || a.CharValue.ToLower() == "false" || a.CharValue.ToLower() == "true"); var isLastEmptyCode = characteristics.Where(a => a.CharValue == "").ToList(); // var removeEmptyCodes = characteristics.Remove(isLastEmptyCode); if (isLastEmptyCode.Count == 0) { characteristics.Add(new CharacteristicModel()); flexGrid.DataSource = characteristics; flexGrid.Cols["Select"].Width = 40; flexGrid.Cols["Select"].Caption = string.Empty; flexGrid.Cols["CharCode"].Visible = false; flexGrid.Cols["CharValue"].Width = 310; flexGrid.Cols["CharValue"].Caption = CharHeaderText; flexGrid.Cols["delete"].Width = 2; flexGrid.Cols["delete"].Caption = string.Empty; //flexGrid.Cols["delete"].ComboList = "..."; flexGrid.Cols["CharStatus"].Visible = false; flexGrid.Cols["OriginalCharValue"].Visible = false; flexGrid.Cols["PreValue"].Visible = false; // flexGrid.Select(characteristics.Count - 1, 2); } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); throw ex; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // license Com.GrapeCity.Xuni.Core.LicenseManager.Key = License.Key; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); this._flexGrid = FindViewById <FlexGrid>(Resource.Id.flexgrid); this._flexGrid.ItemsSource = Customer.GetCustomerList(50); this._flexGrid.CellFactory = new CustomCellFactory(this._flexGrid); this._flexGrid.Columns.GetColumn("Money").Format = "c"; this._flexGrid.Columns.GetColumn("Hired").Format = "MM/dd/yyyy"; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // license Com.GrapeCity.Xuni.Core.LicenseManager.Key = License.Key; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); this._flexGrid = FindViewById<FlexGrid>(Resource.Id.flexgrid); this._flexGrid.ItemsSource = Customer.GetCustomerList(50); this._flexGrid.CellFactory = new CustomCellFactory(this._flexGrid); this._flexGrid.Columns.GetColumn("Money").Format = "c"; this._flexGrid.Columns.GetColumn("Hired").Format = "MM/dd/yyyy"; }
private void DeleteAllCharacteristic_Click(object sender, EventArgs e) { try { IList <CharacteristicModel> charList; GetControlID((sender as Spectrum.Controls.Button).Name.ToLower()); FlexGrid grdCharacteristicTemp = grdCharacteristic; charList = CharacteristicValues.Where(c => c.CharCode == CharCode && c.Select == true).ToList(); if (charList.Count == 0) { CommonFunc.ShowMessage("Please select at least 1 record to delete.", MessageType.Information); return; } if (CommonFunc.ShowMessage("The selected record(s) will be deleted. Are you sure?", MessageType.OKCancel) == DialogResult.OK) { for (int rowIndex = 0; rowIndex < charList.Count(); rowIndex++) { var isValueAssociate = this.characteristicManager.IsProductAssociate(charList[rowIndex].CharValue); if (isValueAssociate == false) { charList[rowIndex].CharStatus = "Deleted"; } else { CommonFunc.ShowMessage(charList[rowIndex].CharValue + " value is associated with Active Products in the system. First remove the Product association.", MessageType.Information); LoadDefaultCharacteristics(); return; } } DefaultGridSetting(ref grdCharacteristicTemp, CharCode); chkCharacteristic.Checked = false; } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
private void GridCharacteristic_CellButtonClick(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { try { FlexGrid grdCharacteristic = sender as FlexGrid; CharCode = GetCharCode(grdCharacteristic.Name); //var charValue = grdCharacteristic.Rows[grdCharacteristic.Row][grdCharacteristic.Col - 1].ToString(); //var characteristicModel = CharacteristicValues.Where(c => c.CharCode == CharCode && c.CharValue == charValue).FirstOrDefault(); //if (characteristicModel != null && CommonFunc.ShowMessage("The selected record will be deleted. Are you sure?", MessageType.OKCancel) == DialogResult.OK) //{ // characteristicModel.CharStatus = "Deleted"; // DefaultGridSetting(ref grdCharacteristic, CharCode); //} } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
private void GridCharacteristic_BeforeSelChange(object sender, C1.Win.C1FlexGrid.RangeEventArgs e) { try { if (!stopCellChangedEvent) { FlexGrid grdCharacteristic = sender as FlexGrid; int rowIndex = grdCharacteristic.Row; //if (grdCharacteristic.Rows[rowIndex]["OriginalCharValue"] == null) // grdCharacteristic.Rows[rowIndex]["OriginalCharValue"] = grdCharacteristic.Rows[rowIndex]["CharValue"]; //if (grdCharacteristic.Rows[rowIndex]["CharStatus"] == null) // grdCharacteristic.Rows[rowIndex]["CharStatus"] = "Modified"; } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
private string SerializeLayout(FlexGrid grid) { var columns = new List <ColumnInfo>(); foreach (var col in grid.Columns) { var colInfo = new ColumnInfo { Name = col.ColumnName, IsVisible = col.IsVisible }; columns.Add(colInfo); } var serializer = new DataContractJsonSerializer(typeof(ColumnInfo[])); var stream = new MemoryStream(); serializer.WriteObject(stream, columns.ToArray()); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); var serializedColumns = new StreamReader(stream).ReadToEnd(); return(serializedColumns); }
private void SelectAllCharacteristic_CheckedChanged(object sender, EventArgs e) { try { GetControlID((sender as CheckBox).Name.ToLower()); FlexGrid grdCharacteristicTemp = grdCharacteristic; var charList = CharacteristicValues.Where(c => c.CharCode == CharCode).ToList(); for (int rowIndex = 0; rowIndex < charList.Count(); rowIndex++) { charList[rowIndex].Select = (sender as CheckBox).Checked; } stopCellChangedEvent = true; DefaultGridSetting(ref grdCharacteristicTemp, CharCode); stopCellChangedEvent = false; } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
public bool FormatItem(FlexGrid sender, GridPanel panel, CellRange range, CGContext context) { FlexGrid g = (FlexGrid)View.ViewWithTag(1); nuint i = (nuint)range.Col; Column col = g.Columns.GetItem <Column>(i); if (col.Binding == "Money") { NSNumberFormatter f = new NSNumberFormatter(); f.NumberStyle = NSNumberFormatterStyle.Currency; Console.WriteLine(g.GetCellData(range.Row, range.Col, true)); NSNumber n; try { n = (NSNumber)g.GetCellData(range.Row, range.Col, false); } catch { n = f.NumberFromString(g.GetCellData(range.Row, range.Col, true).ToString()); } CoreGraphics.CGRect r = panel.GetCellRect(range.Row, range.Col); if (n.Int32Value > 90) { context.SetFillColor(UIColor.Green.CGColor); } else if (n.Int32Value < 60) { context.SetFillColor(UIColor.Red.CGColor); } context.FillRect(r); } return(false); }
public P_CZ_ME_MAP_EMP() { InitializeComponent(); MainGrids = new FlexGrid[] { _flexM }; _flexM.DetailGrids = new FlexGrid[] { _flexD }; }