Exemplo n.º 1
0
        private void btnAgregarProducto_Click(object sender, EventArgs e)
        {
            if (ProductoSeleccionado.ProductoId != 0 && !string.IsNullOrEmpty(txtCant.Text))
            {
                ListGrid.Add(CrearNuevaLinea());

                RecargarDatagrid();

                LimpiarControles();
            }
            else
            {
                if (!string.IsNullOrEmpty(txtCodProd.Text) && !string.IsNullOrEmpty(txtCant.Text))
                {
                    ProductoSeleccionado = productoBLL.ObtenerProductoPorCodigo(txtCodProd.Text);

                    if (ProductoSeleccionado != null)
                    {
                        ListGrid.Add(CrearNuevaLinea());

                        RecargarDatagrid();

                        LimpiarControles();
                    }
                    else
                    {
                        Alert.ShowSimpleAlert("El codigo de producto no existe", "MSJ080");
                    }
                }
                else
                {
                    Alert.ShowSimpleAlert("Debe Seleccionar al menos un producto y la cantidad", "MSJ082");
                }
            }
        }
Exemplo n.º 2
0
 private void InitListView()
 {
     listOptions = new ListGridOptions <IResource>()
     {
         Columns = new List <ListGridColumnDefinition <IResource> >()
         {
             new ListGridColumnDefinition <IResource>()
             {
                 Header    = "Resource".ToYellow(),
                 Formatter = r => new Label()
                 {
                     Text = r.DisplayName.ToConsoleString()
                 },
                 Type  = GridValueType.RemainderValue,
                 Width = 2,
             },
             new ListGridColumnDefinition <IResource>()
             {
                 Header    = "Current Value".ToYellow(),
                 Formatter = r => new Label()
                 {
                     Text = r.GetFormattedSample()
                 },
                 Type  = GridValueType.RemainderValue,
                 Width = 1,
             }
         },
         DataSource        = new SyncList <IResource>(resources),
         ShowColumnHeaders = true,
         ShowPager         = false,
     };
     listView = layout.Add(new ListGrid <IResource>(listOptions), 0, 0);
 }
Exemplo n.º 3
0
 /// <summary>スレッド完了(必要ならスレッド再起動)
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     ListGrid.RowCount = TimeTable.EvaluationItems.Count;
     if (contwrk)
     {
         ListGrid.Refresh();
         contwrk = false;
         Run();
     }
     else
     {
         ListGrid.Refresh();
     }
 }
Exemplo n.º 4
0
        private void AggiornaGridLista(Anime anime)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("id", typeof(string));
            dt.Columns.Add("thumb", typeof(string));
            dt.Columns.Add("title", typeof(string));
            dt.Columns.Add("epInfo", typeof(string));

            for (int i = 0; i < anime.episodes.Count; i++)
            {
                if (anime.episodes[i].playable & anime.episodes[i].vod_mode != 2)
                {
                    dt.Rows.Add(i, anime.episodes[i].thumbnail, anime.episodes[i].number + " - " + anime.episodes[i].title, anime.show_id + "-" + anime.episodes[i].season_id);
                }
            }

            ListGrid.DataSource = dt;
            ListGrid.DataBind();
            dt.Clear();
        }
Exemplo n.º 5
0
        public void TestDataGridBasic()
        {
            var items = new List <Item>();

            for (var i = 0; i < 100; i++)
            {
                items.Add(new Item()
                {
                    Bar = "Bar" + i,
                    Foo = "Foo" + i,
                });
            }

            var app = new CliTestHarness(TestContext, 80, 20, true)
            {
                SecondsBetweenKeyframes = .05
            };

            var dataGrid = new ListGrid <Item>(new ListGridOptions <Item>()
            {
                DataSource = new SyncList <Item>(items),
                Columns    = new List <ListGridColumnDefinition <Item> >()
                {
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo".ToGreen(),
                        Width     = .5,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar".ToRed(),
                        Width     = .5,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    }
                }
            });

            app.InvokeNextCycle(async() =>
            {
                var selectionLabel = app.LayoutRoot.Add(new Label()
                {
                    Text = "DEFAULT".ToConsoleString(), Height = 1
                }).CenterHorizontally();
                selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                dataGrid.SelectionChanged.SubscribeForLifetime(() =>
                {
                    selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                }, dataGrid);
                app.LayoutRoot.Add(dataGrid).Fill(padding: new Thickness(0, 0, 1, 0));
                await app.PaintAndRecordKeyFrameAsync();

                for (var i = 0; i < items.Count - 1; i++)
                {
                    await app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.DownArrow, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }

                for (var i = 0; i < items.Count - 1; i++)
                {
                    await app.SendKey(new ConsoleKeyInfo(' ', ConsoleKey.UpArrow, false, false, false));
                    await app.PaintAndRecordKeyFrameAsync();
                }
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Exemplo n.º 6
0
        public void TestDataGridProgrammaticSelection()
        {
            var items = new List <Item>();

            for (var i = 0; i < 100; i++)
            {
                items.Add(new Item()
                {
                    Bar = "Bar" + i,
                    Foo = "Foo" + i,
                });
            }

            var app = new CliTestHarness(TestContext, 80, 20, true)
            {
            };

            var dataGrid = new ListGrid <Item>(new ListGridOptions <Item>()
            {
                DataSource = new SyncList <Item>(items),
                Columns    = new List <ListGridColumnDefinition <Item> >()
                {
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo".ToGreen(),
                        Width     = 20,
                        Type      = GridValueType.Pixels,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar".ToRed(),
                        Width     = 20,
                        Type      = GridValueType.Pixels,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    }
                },
            });

            app.QueueAction(async() =>
            {
                var selectionLabel = app.LayoutRoot.Add(new Label()
                {
                    Text = "DEFAULT".ToConsoleString(), Height = 1
                }).CenterHorizontally();
                selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                dataGrid.SelectionChanged.SubscribeForLifetime(() =>
                {
                    selectionLabel.Text = $"SelectedRowIndex: {dataGrid.SelectedRowIndex}, SelectedCellIndex: {dataGrid.SelectedColumnIndex}".ToConsoleString();
                }, dataGrid);
                app.LayoutRoot.Add(dataGrid).Fill(padding: new Thickness(0, 0, 1, 0));
                await app.PaintAndRecordKeyFrameAsync();

                dataGrid.SelectedRowIndex = 1;
                await app.PaintAndRecordKeyFrameAsync();
                app.Stop();
            });

            app.Start().Wait();
            app.AssertThisTestMatchesLKG();
        }
Exemplo n.º 7
0
        public void Main()
        {
            var items = new List <Item>();

            for (var i = 0; i < 100; i++)
            {
                items.Add(new Item()
                {
                    Bar = "Bar" + i,
                    Foo = "Foo" + i,
                });
            }

            var app      = new ConsoleApp();
            var dataGrid = new ListGrid <Item>(new ListGridOptions <Item>()
            {
                SelectionMode = DataGridSelectionMode.Row,
                DataSource    = new SlowList(items),
                Columns       = new List <ListGridColumnDefinition <Item> >()
                {
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo".ToGreen(),
                        Width     = .25,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar".ToRed(),
                        Width     = .25,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo2".ToGreen(),
                        Width     = .15,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar2".ToRed(),
                        Width     = .15,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Foo3".ToGreen(),
                        Width     = .15,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Foo.ToConsoleString()
                        }
                    },
                    new ListGridColumnDefinition <Item>()
                    {
                        Header    = "Bar3".ToRed(),
                        Width     = .15,
                        Type      = GridValueType.Percentage,
                        Formatter = (item) => new Label()
                        {
                            Text = item.Bar.ToConsoleString()
                        }
                    }
                }
            });

            app.LayoutRoot.Add(dataGrid).Fill();
            app.Start().Wait();
            return;

            var winSound = new WindowsSoundProvider.SoundProvider();

            Sound.Provider = winSound;
            winSound.StartPromise.Wait();
            new DemoMultiPlayerGameApp().Start().Wait();
            Sound.Dispose();
        }
Exemplo n.º 8
0
 private void btnQuitarProd_Click(object sender, EventArgs e)
 {
     ListGrid.Remove(LineaDetalleSeleccionada);
     RecargarDatagrid();
 }
Exemplo n.º 9
0
        public async void ViewEstimate_Ok()
        {
            if (SelectedEstimate.EstimateID != null && SelectedEstimate.EstimateID != 0)
            {
                App.Current.Properties["Action"] = "ViewEstimate";
                List <EstimateModel> _ListGrid_Temp = new List <EstimateModel>();
                HttpClient           client         = new HttpClient();
                client.BaseAddress = new Uri(GlobalData.gblApiAdress);
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                client.Timeout = new TimeSpan(500000000000);
                int id = SelectedEstimate.EstimateID;
                HttpResponseMessage response = client.GetAsync("api/EstimateAPI/ViewEstimateItem?id=" + SelectedEstimate.EstimateID + "").Result;
                if (response.IsSuccessStatusCode)
                {
                    data = JsonConvert.DeserializeObject <EstimateModel[]>(await response.Content.ReadAsStringAsync());
                    int x = 0;
                    if (data.Length > 0)
                    {
                        for (int i = 0; i < data.Length; i++)
                        {
                            SelectedEstimate.EstimateNo       = data[i].EstimateNo;
                            SelectedEstimate.EstimateID       = data[i].EstimateID;
                            SelectedEstimate.Barcode          = data[i].Barcode;
                            SelectedEstimate.BusinessLocation = data[i].BusinessLocation;
                            SelectedEstimate.CashRegister     = data[i].CashRegister;
                            SelectedEstimate.CountItem        = data[i].CountItem;
                            SelectedEstimate.CustomerName     = data[i].CustomerName;
                            SelectedEstimate.EmployeeLogin    = data[i].EmployeeLogin;
                            SelectedEstimate.TotalItemQty     = data[i].TotalItemQty;
                            SelectedEstimate.TotalPrice       = data[i].TotalPrice;
                            SelectedEstimate.EstimateDate     = data[i].EstimateDate;
                            //SelectedEstimate.TotalTax = data[i].TotalTax;
                        }
                        ListGrid.Add(new EstimateModel
                        {
                            Barcode          = SelectedEstimate.Barcode,
                            EstimateID       = SelectedEstimate.EstimateID,
                            EstimateNo       = SelectedEstimate.EstimateNo,
                            BusinessLocation = SelectedEstimate.BusinessLocation,
                            CashRegister     = SelectedEstimate.CashRegister,
                            CountItem        = SelectedEstimate.CountItem,
                            CustomerName     = SelectedEstimate.CustomerName,
                            EmployeeLogin    = SelectedEstimate.EmployeeLogin,
                            TotalItemQty     = SelectedEstimate.TotalItemQty,
                            TotalPrice       = SelectedEstimate.TotalPrice,
                            ItemName         = SelectedEstimate.ItemName
                        });
                        App.Current.Properties["ViewEstimate"] = SelectedEstimate;
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TotalAmount.Text = SelectedEstimate.TotalPrice.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.EstimateNo.Text = SelectedEstimate.EstimateNo.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.EstimateDate.Text = SelectedEstimate.EstimateDate.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TotalQty.Text = SelectedEstimate.TotalItemQty.ToString();
                        //InvoicePOS.UserControll.Estimate.ViewEstimate.TaxAmount.Text = SelectedEstimate.TotalTax.ToString();
                        //List<EstimateModel> _hft = App.Current.Properties["ViewEstimate"] as List<EstimateModel>;
                        //Estimate.ListGridRef.ItemsSource = _hft;
                        //ListGrid = _hft;
                        ViewEstimateClick_Ok();
                    }
                }
            }


            else
            {
                MessageBox.Show("Select Customer first", "Customer Selection", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }