Esempio n. 1
0
        public void SpreadsheetCellSelected(object sender, CurrentCellActivatedEventArgs e)
        {
            if (e.ActivationTrigger == ActivationTrigger.Program || _generator?.Graph == null)
            {
                return;
            }

            string sheetName = spreadsheet.ActiveSheet.Name;
            var    vertex    = _generator.Graph.GetVertexByAddress(sheetName, e.CurrentRowColumnIndex.RowIndex, e.CurrentRowColumnIndex.ColumnIndex);

            if (vertex == null || (vertex is CellVertex cellVertex &&
                                   cellVertex.Classification == Classification.None &&
                                   cellVertex.CellType == CellType.Unknown))
            {
                InitiateToolbox(null);
            }
        private void datagrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args)
        {
            //Skip the selection moved to next row when adding new row.
            bool needToMove = (dataGrid.IsAddNewIndex(args.PreviousRowColumnIndex.RowIndex) &&
                               !dataGrid.IsAddNewIndex(args.CurrentRowColumnIndex.RowIndex) &&
                               (Keyboard.IsKeyDown(Key.Enter) || Keyboard.IsKeyDown(Key.Tab)));

            Dispatcher.BeginInvoke(new Action(() =>
            {
                var gridModel   = this.dataGrid.GetGridModel();
                var columnIndex = this.dataGrid.GetFirstColumnIndex();
                if (needToMove && gridModel != null)
                {
                    this.dataGrid.MoveCurrentCell(new RowColumnIndex(gridModel.AddNewRowController.GetAddNewRowIndex(), columnIndex));
                }
            }), DispatcherPriority.ApplicationIdle);
        }
Esempio n. 3
0
        private void datagrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args)
        {
            //Skip the selection moved to next row when adding new row.
            bool needToMove = (dataGrid.IsAddNewIndex(args.PreviousRowColumnIndex.RowIndex) &&
                               !dataGrid.IsAddNewIndex(args.CurrentRowColumnIndex.RowIndex) &&
                               (Window.Current.CoreWindow.GetAsyncKeyState(VirtualKey.Enter).HasFlag(CoreVirtualKeyStates.Down) || Window.Current.CoreWindow.GetAsyncKeyState(VirtualKey.Tab).HasFlag(CoreVirtualKeyStates.Down)));

            Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                  () =>
            {
                var gridModel   = this.dataGrid.GetGridModel();
                var columnIndex = this.dataGrid.GetFirstColumnIndex();
                if (needToMove && gridModel != null)
                {
                    this.dataGrid.MoveCurrentCell(new RowColumnIndex(gridModel.AddNewRowController.GetAddNewRowIndex(), columnIndex));
                }
            });
        }
Esempio n. 4
0
 void cellgrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs args)
 {
     eventsTxtBox.Text += "\nCurrent Cell activated : " + args.CurrentRowColumnIndex.ToString();
 }
Esempio n. 5
0
 private void ListDataGrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
 {
     OnListDataGridCurrentCellActivated?.Invoke(sender, e);
 }
 private void _view_OnListDataGridCurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
 {
     _view.ListDataGrid.CurrentCell.BeginEdit();
 }
        private void GridConfig_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
        {
            try
            {
                bool t = this.GridConfig.View.IsAddingNew;

                if (!t)
                {
                    if ((e.CurrentRowColumnIndex.RowIndex) > GridConfig.View.Records.Count)
                    {
                        if (e.CurrentRowColumnIndex.ColumnIndex > 0)
                        {
                            this.GridConfig.SelectionController.CurrentCellManager.BeginEdit();
                        }
                    }
                    else
                    {
                        GridConfig.UpdateLayout();
                        var    reflector   = this.GridConfig.View.GetPropertyAccessProvider();
                        int    columnIndex = (sender as SfDataGrid).SelectionController.CurrentCellManager.CurrentRowColumnIndex.RowIndex;
                        var    rowData     = GridConfig.GetRecordAtRowIndex(columnIndex);
                        string refe        = reflector.GetValue(rowData, "cod_ref").ToString().Trim();

                        if (string.IsNullOrEmpty(refe))
                        {
                            this.GridConfig.SelectionController.CurrentCellManager.BeginEdit();
                        }
                    }
                }

                if (Keyboard.IsKeyDown(Key.Tab) || Keyboard.IsKeyDown(Key.Right) || Keyboard.IsKeyDown(Key.Return))
                {
                    var reflector   = this.GridConfig.View.GetPropertyAccessProvider();
                    int columnIndex = (sender as SfDataGrid).SelectionController.CurrentCellManager.CurrentRowColumnIndex.RowIndex;
                    var rowData     = GridConfig.GetRecordAtRowIndex(columnIndex);
                    if (DBNull.Value.Equals(reflector.GetValue(rowData, "cod_ref")))
                    {
                        dynamic ww = SiaWin.WindowExt(9326, "InBuscarReferencia");  //carga desde sql
                        ww.Conexion              = SiaWin.Func.DatosEmp(idemp);
                        ww.idEmp                 = idemp;
                        ww.idBod                 = tx_bodega.Text;
                        ww.UltBusqueda           = "";
                        ww.ShowInTaskbar         = false;
                        ww.Owner                 = Application.Current.MainWindow;
                        ww.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                        ww.Height                = 400;
                        ww.ShowDialog();
                        string code = ww.Codigo;

                        if (string.IsNullOrEmpty(code))
                        {
                            return;
                        }

                        var func = refe(code);
                        reflector.SetValue(rowData, "cod_ref", func.Item2.Rows[0]["cod_ref"].ToString().Trim());
                        reflector.SetValue(rowData, "nom_ref", func.Item2.Rows[0]["nom_ref"].ToString().Trim());
                        double getCant = 1;
                        if (DBNull.Value.Equals(reflector.GetValue(rowData, "cantidad")))
                        {
                            reflector.SetValue(rowData, "cantidad", 1);
                        }

                        double saldoin = Convert.ToDouble(SiaWin.Func.SaldoInv(func.Item2.Rows[0]["cod_ref"].ToString().Trim(), tx_bodega.Text, cod_empresa));
                        reflector.SetValue(rowData, "saldo", saldoin);
                        double fal = saldoin - getCant;
                        reflector.SetValue(rowData, "faltantes", fal >= 0 ? 0 : fal);
                        reflector.SetValue(rowData, "val_ref", Convert.ToDouble(func.Item2.Rows[0]["val_ref"].ToString()));
                        double sub = Convert.ToDouble(func.Item2.Rows[0]["val_ref"]) * getCant;
                        reflector.SetValue(rowData, "subtotal", sub);


                        GridConfig.UpdateDataRow(columnIndex);
                        GridConfig.UpdateLayout();
                        GridConfig.Columns["cod_ref"].AllowEditing = true;
                    }

                    else
                    {
                        string referen = reflector.GetValue(rowData, "cod_ref").ToString().Trim();

                        if (string.IsNullOrEmpty(referen))
                        {
                            dynamic ww = SiaWin.WindowExt(9326, "InBuscarReferencia");  //carga desde sql
                            ww.Conexion              = SiaWin.Func.DatosEmp(idemp);
                            ww.idEmp                 = idemp;
                            ww.idBod                 = tx_bodega.Text;
                            ww.UltBusqueda           = "";
                            ww.ShowInTaskbar         = false;
                            ww.Owner                 = Application.Current.MainWindow;
                            ww.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                            ww.Height                = 400;
                            ww.ShowDialog();
                            string code = ww.Codigo;

                            if (string.IsNullOrEmpty(code))
                            {
                                return;
                            }

                            var func = refe(code);

                            reflector.SetValue(rowData, "cod_ref", func.Item2.Rows[0]["cod_ref"].ToString().Trim());
                            reflector.SetValue(rowData, "nom_ref", func.Item2.Rows[0]["nom_ref"].ToString().Trim());
                            double getCant = 1;
                            if (DBNull.Value.Equals(reflector.GetValue(rowData, "cantidad")))
                            {
                                reflector.SetValue(rowData, "cantidad", 1);
                            }

                            double saldoin = Convert.ToDouble(SiaWin.Func.SaldoInv(func.Item2.Rows[0]["cod_ref"].ToString().Trim(), tx_bodega.Text, cod_empresa));
                            reflector.SetValue(rowData, "saldo", saldoin);
                            double fal = saldoin - getCant;
                            reflector.SetValue(rowData, "faltantes", fal >= 0 ? 0 : fal);
                            reflector.SetValue(rowData, "val_ref", Convert.ToDouble(func.Item2.Rows[0]["val_ref"].ToString()));
                            double sub = Convert.ToDouble(func.Item2.Rows[0]["val_ref"]) * getCant;
                            reflector.SetValue(rowData, "subtotal", sub);

                            GridConfig.UpdateDataRow(columnIndex);
                            GridConfig.UpdateLayout();
                            GridConfig.Columns["cod_ref"].AllowEditing = true;
                        }
                    }
                }
            }
            catch (Exception w)
            {
                SiaWin.Func.SiaExeptionGobal(w);
                MessageBox.Show("QQQ:" + w);
            }
        }