Пример #1
0
        public SyncPage()
        {
            hud.Show();
            hud.Dismiss();



            Initialize();
        }
 void FileManager_OnFileDownloaded(object sender, DownloadEventArgs e)
 {
     hud.Dismiss();
     if (e.FileSaved)
     {
         PlayFile(e.FileName);
     }
     else
     {
         hud.ShowError("Couldn't download file");
         System.Diagnostics.Debug.WriteLine($"Couldn't download file: {e.FileName}");
     }
 }
Пример #3
0
        public void TechnicianListPageViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            TechnicianListPageViewModel vm = sender as TechnicianListPageViewModel;

            switch (e.PropertyName)
            {
            case "IsLoading":
                IHud hud = DependencyService.Get <IHud>();
                if (vm.IsLoading)
                {
                    //XHUD.HUD.Show("Loading data...", -1, XHUD.MaskType.Black);

                    hud.Show("Loading data...");
                }
                else
                {
                    hud.Dismiss();
                }
                break;

            case "IsSignedIn":
                if (vm.IsSignedIn)
                {
                    Device.BeginInvokeOnMainThread(() =>
                                                   MainPage = new MainDashboard());
                    //MainPage = new MainDashboard(this);
                }
                else
                {
                    if (!(MainPage is TechnicianListPage))
                    {
                        MainPage = new TechnicianListPage(vm);
                    }
                }
                break;

            default:
                break;
            }
        }
        public TechnicianListPage(TechnicianListPageViewModel viewModel)
        {
            hud.Show();
            hud.Dismiss();
            // Set the page title.
            NavigationPage.SetHasNavigationBar(this, true);
            Title = "Technican Dashboard";
            _activityIndicator = new ActivityIndicator()
            {
                Color = Color.Red
            };
            _activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");
            _activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, "IsLoading");
            _activityIndicator.BindingContext = _vm;
            BackgroundColor = Color.White;
            // Create the view model for this page
            _vm = viewModel;   //new TechnicianListPageViewModel();

            // Set the binding context for this page
            BindingContext = _vm.TechnicianList;

            // Create our screen objects
            //  Create a label for the technician list
            _labelTitle            = new Xamarin.Forms.Label();
            _labelTitle.Text       = "SELECT TECHNICIAN";
            _labelTitle.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
            _labelTitle.FontSize   = 22;
            _labelTitle.TextColor  = Color.White;
            _labelTitle.HorizontalTextAlignment = TextAlignment.Center;
            _labelTitle.VerticalTextAlignment   = TextAlignment.Center;


            Grid titleLayout = new Grid()
            {
                BackgroundColor   = Color.FromHex("#2980b9"),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = 80
            };

            titleLayout.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            titleLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            titleLayout.Children.Add(_labelTitle, 0, 0);

            // Create a template to display each technician in the list
            var dataTemplateItem = new DataTemplate(typeof(TechnicialDataCell));

            // Create the actual list
            _listViewTechnicians = new ListView()
            {
                HasUnevenRows       = true,
                HorizontalOptions   = LayoutOptions.Fill,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.White,

                ItemsSource  = _vm.TechnicianList,
                ItemTemplate = dataTemplateItem
            };


            _listViewTechnicians.ItemTapped += ListViewTechnicians_ItemTapped;

            StackLayout layout = new StackLayout
            {
                BackgroundColor   = Color.FromHex("#2980b9"),
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    titleLayout,
                    _activityIndicator,
                    _listViewTechnicians
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                // move layout under the status bar
                layout.Padding = new Thickness(0, 40, 0, 0);
            }
            Content = layout;
        }