Пример #1
0
        public LocationNotificationSendPage()
        {
            Title = "Notify";
            locationLabel.Text = "Location to Send to:";

            _client = new OMGITServiceClient(binding, EndPoint);
            //System.Collections.Generic.SortedDictionary<int,string> validLocations = (SortedDictionary<int,string>)

            _client.GetValidSendLocationsCompleted += ClientSendLocationsCompleted;
            _client.GetValidSendLocationsAsync(GlobalData.loginData);


            LocationPicker.Title = "Select Location to Send to:";
            while (validLocations.Count < 1)
            {
                Task.Delay(100).Wait();
            }

            foreach (KeyValuePair <int, string> entry in validLocations)
            {
                LocationPicker.Items.Add(entry.Value);
            }


            sendNotificationPush.Clicked += SendNotification_Clicked;
            adminLayout.Children.Add(SubjectMessage);
            adminLayout.Children.Add(NotificationMessage);
            adminLayout.Children.Add(locationLabel);
            adminLayout.Children.Add(LocationPicker);
            adminLayout.Children.Add(sendNotificationPush);
            ScrollView adminView = new ScrollView {
                BackgroundColor = Color.FromHex("14986D"), Content = adminLayout
            };

            Content = adminView;
            Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
        }
Пример #2
0
        public LocationNotificationSendPage()
        {
            Title = "Notify";
            locationLabel.Text = "Location to Send to:";

            try
            {
                _client = new OMGITServiceClient(binding, EndPoint);

                _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Setting title", 0, GlobalData.loginData);
                LocationPicker.Title = "Select Location to Send to:";


                //System.Collections.Generic.SortedDictionary<int,string> validLocations = (SortedDictionary<int,string>)

                _client.GetValidSendLocationsCompleted += ClientSendLocationsCompleted;
                _client.GetValidSendLocationsAsync(GlobalData.loginData);

                while (ValidLocations.Count < 1)
                {
                    Task.Delay(100).Wait();
                }

                //_client.AddLogMessageTickerAppAsync("In Location Notification Send Page", "Done getting valid locations");

                //foreach (KeyValuePair<int, string> entry in validLocations)
                //{
                //    LocationPicker.Items.Add(entry.Value);

                //}


                foreach (KeyValuePair <int, string> entry in ValidLocations)
                {
                    StackLayout ClinicLayout = new StackLayout {
                        Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill
                    };
                    ClinicLayout.Children.Add(new Switch {
                        HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center
                    });
                    ClinicLayout.Children.Add(new Label {
                        Text = entry.Value, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, TextColor = Color.White
                    });
                    ClinicLayout.Children.Add(new Label {
                        Text = entry.Key.ToString(), HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, IsVisible = false
                    });
                    AllClinicsLayout.Children.Add(ClinicLayout);
                }

                _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Items added to Location Picker", 0, GlobalData.loginData);


                sendNotificationPush.Clicked += SendNotification_Clicked;
                Logout.Clicked += Logout_Clicked;

                adminLayout.Children.Add(Logout);
                adminLayout.Children.Add(SubjectMessage);
                adminLayout.Children.Add(NotificationMessage);
                adminLayout.Children.Add(locationLabel);
                adminLayout.Children.Add(AllClinicsLayout);
                //adminLayout.Children.Add(LocationPicker);
                adminLayout.Children.Add(sendNotificationPush);
                ScrollView adminView = new ScrollView {
                    BackgroundColor = Color.Black, Content = adminLayout
                };
                Content = adminView;
                Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);


                _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Done creating page", 0, GlobalData.loginData);
            }
            catch (Exception ex)
            {
                _client.AddLogMessageMobileAsync("In Location Notification Send Page. Error: ", ex.Message.ToString(), 0, GlobalData.loginData);
            }
        }