async private void ToolbarItem_Save_Activated(object sender, EventArgs e)
        {
            var response = await DisplayAlert("Warning", "Are you sure you want to Create this Printer?", "Yes", "No");

            if (response)
            {
                var exists = await PrinterViewModel.SearchByName(ent_Name.Text);

                if (exists != null)
                {
                    await DisplayAlert("ERROR", "Name already Used. Please choose another", "OK");
                }
                else
                {
                    var status = await StatusViewModel.SearchByName(Status_Picker.Text);

                    var printColor = await PrintColorViewModel.SearchByName(Color_Picker.Text);

                    var printer = new PrinterViewModel()
                    {
                        Name           = ent_Name.Text,
                        StatusID       = status.ID,
                        ColorID        = printColor.ID,
                        Status         = status,
                        PrintColor     = printColor,
                        ProjectsQueued = 0,
                    };

                    await PrinterViewModel.Insert(printer);
                }
            }
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var StringList = new List <string>();

            foreach (var p in await PrintColorViewModel.GetAll())
            {
                StringList.Add(p.Name);
            }
            Color_ListView.ItemsSource = StringList;
        }
Exemplo n.º 3
0
        private async void ToolbarItem_Save_Activated(object sender, EventArgs e)
        {
            var exists = await PrintColorViewModel.SearchByName(ent_Name.Text);

            if (exists == null)
            {
                var printcolor = new PrintColorViewModel()
                {
                    Name     = ent_Name.Text,
                    HexValue = ent_HexValue.Text,
                };
                await PrintColorViewModel.Insert(printcolor);

                await DisplayAlert("Success!", "Print Color was successfully save!", "OK");

                await Navigation.PopAsync();
            }
            else
            {
                await DisplayAlert("ERROR", "Name already Used. Please choose another", "OK");
            }
        }