Пример #1
0
 public void FillObjectsList(InputStructure IS, ItemList Page_IL, ItemsRequestStructure locParent)
 {
     Page_IL.lv_Items.Clear();
     foreach (TablePart TP in IS.Table0)
     {
         Page_IL.lv_Items.Add(new TablePart
         {
             Metadata = TP.Metadata,
             UID      = TP.UID,
             Value0   = TP.Value0,
             Value1   = TP.Value1,
             Value2   = TP.Value2,
             Value3   = TP.Value3,
             Value4   = TP.Value4,
             Value5   = TP.Value5,
             Value6   = TP.Value6,
             Value7   = TP.Value7,
             Value8   = TP.Value8,
             Value9   = TP.Value9,
             Value10  = TP.Value10,
             Value11  = TP.Value11,
             Value12  = TP.Value12,
             Value13  = TP.Value13,
             Value14  = TP.Value14,
             Value15  = TP.Value15,
             Value16  = TP.Value16,
             Value17  = TP.Value17,
             Value18  = TP.Value18,
             Value19  = TP.Value19,
         });
     }
 }
Пример #2
0
        private void Tgr_Tapped(object sender, EventArgs e)
        {
            ItemsRequestStructure P = (ItemsRequestStructure)((TappedEventArgs)e).Parameter;
            if (P.Intent == "AmountAquired")
            {
                Navigation.PushAsync(new Page_EnterValue(GoodItem, this, P, "EnterAmount"));
                return;
            }

            if (P.Intent == "GoodDescription")
            {
                P.ParentUID = GoodItem.uidGood;
            };

            if (P.Intent == "Serial")
            {
                P.ParentUID = GoodItem.uidGood;
            };

            if (P.Intent == "Unit")
            {
                P.ParentUID = GoodItem.uidGood;
            };

            Navigation.PushAsync(new Page_EnterValue(GoodItem, this, P, "Filter"));
        }
Пример #3
0
        public async Task <bool> GetItemListByFilter(ContentPage Context, ItemsRequestStructure P, string Filter)
        {
            OutputStructure OS = new OutputStructure();

            OS.Intent   = "GetItemListByFilter";
            OS.DeviceID = new CommonProcs().GetProperty("ext_TabSel_Other_DeviceID");

            OS.Value0 = P.Metadata;
            OS.Value1 = Filter;
            OS.Value2 = P.ParentMetadata;
            OS.Value3 = P.ParentUID;


            //if (!CrossConnectivity.Current.IsConnected)
            //{
            //    await ((MainPage)Context).DisplayAlert("Error!", "Нет подключения к сети.", "ok");
            //    return false;
            //}
            object ip = "";

            App.Current.Properties.TryGetValue("ext_Address", out ip);

            string            FullServiceAddr = ip.ToString();
            JsonSerialization JS           = new JsonSerialization();
            string            OutputString = JS.Serialize(OS);

            Status res = await HttpRequest(OutputString, FullServiceAddr,
                                           new CommonProcs().GetProperty("ext_Login"), new CommonProcs().GetProperty("ext_Password"), Context);

            if (!res.MajorStatus)
            {
                await Context.DisplayAlert("Error!", "Ошибка при обмене с сервисом: " + res.MinorStatus.ToString(), "ok");

                return(false);
            }
            try
            {
                FillObjectsList(new JsonSerialization().deserializeJSON <InputStructure>((string)res.MinorStatus), (ItemList)Context, P);
            }
            catch
            {
                await Context.DisplayAlert("Error!", "Ошибка при разборке полученного пакета!", "ok");

                return(false);
            }

            return(true);
        }
Пример #4
0
        public ItemList(Good reflocGood, string locFilter, ItemsRequestStructure locParent, ContentPage locContext, string locMode)
        {
            refGood = reflocGood;
            Filter  = locFilter;
            Parent  = locParent;
            Context = locContext;
            Mode    = locMode;

            StackLayout stack = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //1.Get Element list from server (if this is a good, then fill additional info, like serial, description, Units)


            switch (locMode)
            {
            case "RequestServerForItems":
                Title = "Найденные объекты";
                Device.BeginInvokeOnMainThread(MethodInvoker);
                break;

            case "DisplayItemListForSelection":
                Title = "Выберите 1 из дублей ШК";
                break;

            case "OnlyDisplayItemList":
                Title = "Товары по отбору";
                break;

            default:
                break;
            }


            lv_Items.Add(new TablePart
            {
                Value0 = "Good",
                Value1 = "Unit",
                Value3 = "Description",
                Value5 = "Serial",
                Value7 = "Quality",
            });

            //2.Build page layout
            ListView lv_Main = new ListView
            {
                ItemsSource  = lv_Items,
                ItemTemplate = new DataTemplate(() =>

                {
                    Grid G = new Grid
                    {
                        ColumnSpacing     = 1,
                        BackgroundColor   = (Color)App.Current.Resources["textColor"],
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        ColumnDefinitions =
                        {
                            //new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                            //new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },

                            new ColumnDefinition {
                                Width = new GridLength(1, GridUnitType.Star)
                            },
                        },
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(42, GridUnitType.Absolute)
                            }
                        },
                        HorizontalOptions = LayoutOptions.FillAndExpand
                    };

                    //======== Field 0

                    Xamarin.Forms.Label l = new Xamarin.Forms.Label
                    {
                        BackgroundColor   = (Color)App.Current.Resources["backColor"],
                        TextColor         = (Color)App.Current.Resources["textColor"],
                        FontSize          = 13,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                    };

                    TapGestureRecognizer tgr = new TapGestureRecognizer
                    {
                        NumberOfTapsRequired = 1,
                        CommandParameter     = lv_Items.Count - 1
                    };
                    tgr.Tapped += Tgr_Tapped;

                    l.GestureRecognizers.Add(tgr);

                    l.SetBinding(Xamarin.Forms.Label.TextProperty, "Value0");
                    //f.Content = l;
                    G.Children.Add(l, 0, 0);


                    ////======== Field 1

                    //Label l1 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l1.SetBinding(Label.TextProperty, "Value1");

                    //TapGestureRecognizer tgr1 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr1.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr1);

                    ////f1.Content = l1;
                    //G.Children.Add(l1, 1, 0);

                    ////======== Field 2

                    //Label l2 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l2.SetBinding(Label.TextProperty, "Value3");
                    //TapGestureRecognizer tgr2 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr2.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr2);

                    ////f2.Content = l2;
                    //G.Children.Add(l2, 2, 0);

                    ////======== Field 3

                    //Label l3 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,

                    //};
                    //l3.SetBinding(Label.TextProperty, "Value5");
                    //TapGestureRecognizer tgr3 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr3.Tapped += Tgr_Tapped;

                    //l.GestureRecognizers.Add(tgr3);
                    ////f3.Content = l3;
                    //G.Children.Add(l3, 3, 0);

                    ////======== Field 4

                    //Label l4 = new Label
                    //{
                    //    BackgroundColor = (Color)App.Current.Resources["backColor"],
                    //    TextColor = (Color)App.Current.Resources["textColor"],
                    //    FontSize = 10,
                    //    HorizontalOptions = LayoutOptions.FillAndExpand,
                    //    VerticalOptions = LayoutOptions.FillAndExpand,
                    //};

                    //TapGestureRecognizer tgr4 = new TapGestureRecognizer
                    //{
                    //    NumberOfTapsRequired = 1,
                    //    CommandParameter = lv_Items.Count - 1
                    //};
                    //tgr4.Tapped += Tgr_Tapped;

                    //l4.GestureRecognizers.Add(tgr4);

                    //l4.SetBinding(Label.TextProperty, "Value7");
                    ////f4.Content = l4;
                    //G.Children.Add(l4, 4, 0);


                    StackLayout s = new StackLayout
                    {
                        Orientation     = StackOrientation.Vertical,
                        BackgroundColor = (Color)App.Current.Resources["textColor"],
                        VerticalOptions = LayoutOptions.FillAndExpand
                    };
                    s.Children.Add(G);

                    return(new ViewCell {
                        View = s
                    });
                })
            };

            stack.Children.Add(lv_Main);
            Content = stack;
        }
Пример #5
0
        public void AddCluster(StackLayout stack, string ClusterName, ItemsRequestStructure locParent)
        {
            Grid grid = CreateGrid(90);
            Frame f = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            f.Content = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = Color.Gray,
                FontSize = 16,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment = TextAlignment.Center,
                Text = ClusterName,
            };

            grid.Children.Add(f, 0, 0);

            Xamarin.Forms.Label l = new Xamarin.Forms.Label
            {
                BackgroundColor = (Color)App.Current.Resources["backColor"],
                TextColor = (Color)App.Current.Resources["textColor"],
                FontSize = 14,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center,
                BindingContext = GoodItem,

            };
            l.SetBinding(Xamarin.Forms.Label.TextProperty, locParent.VarName);
            TapGestureRecognizer tgr = new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                CommandParameter = locParent
            };
            tgr.Tapped += Tgr_Tapped;
            l.GestureRecognizers.Add(tgr);

            Frame f1 = new Frame
            {
                OutlineColor = Color.White,
                Padding = new Thickness(1),
                BackgroundColor = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };
            f1.Content = l;

            grid.Children.Add(f1, 1, 0);

            Image I1 = new Image
            {
                Source = "loop_72_72.PNG"
            };
            TapGestureRecognizer tgr1 = new TapGestureRecognizer { NumberOfTapsRequired = 1, CommandParameter = locParent };
            tgr1.Tapped += Tgr1_Tapped;
            I1.GestureRecognizers.Add(tgr1);

            grid.Children.Add(I1, 2, 0);

            stack.Children.Add(grid);
        }
Пример #6
0
        public Page_EnterValue(Good locGood, ContentPage locPage, ItemsRequestStructure locParent, string locMode)
        {
            Mode       = locMode;
            ParentPage = locPage;
            Parent     = locParent;
            refGood    = locGood;
            switch (Mode)
            {
            case "Filter":
                Title = "Введите фильтр/сканируйте ШК";
                break;

            case "EnterAmount":
                Title  = "Введите число";
                Filter = refGood.AmountAquired == "0" ? "" : refGood.AmountAquired;
                break;

            case "Enlight":
                Title = "Введите строку поиска";
                break;

            default:
                break;
            }

            StackLayout stack = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BindingContext    = this
            };

            StackLayout StackVertical = new StackLayout
            {
                BackgroundColor   = (Color)App.Current.Resources["backColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Horizontal,
                BindingContext    = this
            };

            Entry E = new Entry
            {
                BackgroundColor   = Color.Gray,
                TextColor         = (Color)App.Current.Resources["textColor"],
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BindingContext    = this
            };

            E.SetBinding(Entry.TextProperty, "Filter");
            //E.Focus();

            StackVertical.Children.Add(E);

            if (AppGlobals.refMicrophoneFeature)
            {
                Image I1 = new Image
                {
                    Source            = "VoiceRec.PNG",
                    HorizontalOptions = LayoutOptions.End
                };

                TapGestureRecognizer tgr = new TapGestureRecognizer
                {
                    NumberOfTapsRequired = 1
                };
                tgr.Tapped += Tgr__Image1_Tapped;
                I1.GestureRecognizers.Add(tgr);
                StackVertical.Children.Add(I1);
            }

            //stack.Children.Add(E);
            stack.Children.Add(StackVertical);

            Button B;

            if (Mode == "Filter")
            {
                if (new CommonProcs().GetProperty("ext_ScanHardWare") == "1")
                {
                    B = new Button
                    {
                        Text = "Сканировать",
                    };
                    B.Clicked += Сканировать_Clicked;
                    stack.Children.Add(B);
                }
            }

            B = new Button
            {
                Text = "Ok"
            };
            B.Clicked += Ok_Clicked;
            stack.Children.Add(B);

            Content = stack;
        }