Exemple #1
0
        public void ShowToast(ToastConfig config, ToastModes mode = ToastModes.Info)
        {
            switch (mode)
            {
            case ToastModes.Error:
                config.SetBackgroundColor(Color.Red);
                config.SetMessageTextColor(Color.White);
                //config.SetIcon(AppImages.Error);
                //config.Position = ToastPosition.Top;
                break;

            case ToastModes.Warning:
                config.SetBackgroundColor(Color.Yellow);
                config.SetMessageTextColor(Color.Black);
                //config.SetIcon(AppImages.Warning);
                //config.Position = ToastPosition.Top;
                break;


            case ToastModes.Info:
                config.SetBackgroundColor(Color.LightGray);
                config.SetMessageTextColor(Color.Black);
                //config.SetIcon(AppImages.Info);
                break;
            }
            UserDialogs.Instance.Toast(config);
        }
Exemple #2
0
        public static void ToastMessage(string message, Color color, string goPage)
        {
            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                ToastConfig tc = new ToastConfig(message);
                tc.SetBackgroundColor(color);

                if (color == Color.Aquamarine)
                {
                    tc.SetMessageTextColor(Color.Black);
                    tc.SetPosition(ToastPosition.Bottom);
                }
                else
                {
                    tc.SetMessageTextColor(Color.White);
                    tc.SetPosition(ToastPosition.Bottom);
                }

               
                tc.SetDuration(TimeSpan.FromSeconds(5.0));


                tc.SetAction(x => x.SetText("Ir >").SetAction(() => App.gotopage(goPage)));
              

                UserDialogs.Instance.Toast(tc);
            });
        }
Exemple #3
0
        private async void BtnCancelarOrden_Clicked(object sender, EventArgs e)
        {
            await Task.Factory.StartNew(() => {
                var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                for (int i = 0; i <= 5; i++)
                {
                    var filename = Path.Combine(documents, i.ToString() + ".txt");
                    try
                    {
                        File.Delete(filename);
                    }
                    catch (FileNotFoundException)
                    {
                    }
                }
            });

            await Navigation.PopToRootAsync();

            await Task.Factory.StartNew(() => {
                var toastConfig = new ToastConfig("Orden Cancelada");
                toastConfig.SetDuration(2000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(255, 52, 0));
                toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(255, 255, 255));
                toastConfig.SetPosition(ToastPosition.Top);

                UserDialogs.Instance.Toast(toastConfig);
            });
        }
        public static void ShowToast(string message, DialogType type)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(3000);
            switch (type)
            {
            case DialogType.Success:
                toastConfig.SetBackgroundColor(Color.Green);
                break;

            case DialogType.Information:
                toastConfig.SetBackgroundColor(Color.Blue);
                break;

            case DialogType.Warning:
                toastConfig.SetBackgroundColor(Color.LightBlue);
                break;

            case DialogType.Error:
                toastConfig.SetBackgroundColor(Color.Red);
                break;

            default:
                break;
            }

            toastConfig.SetMessageTextColor(Color.White);

            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #5
0
        public void ShowNotifaciton(ToastNotificationTypeEnum type, string message, int delay = 2000)
        {
            var config = new ToastConfig(message);

            config.SetPosition(ToastPosition.Bottom);
            config.SetDuration(delay);
            config.SetMessageTextColor(System.Drawing.Color.White);

            switch (type)
            {
            case ToastNotificationTypeEnum.Error:
                config.SetBackgroundColor(System.Drawing.Color.DarkRed);
                break;

            case ToastNotificationTypeEnum.Success:
                config.SetBackgroundColor(System.Drawing.Color.Green);
                break;

            case ToastNotificationTypeEnum.Info:
                config.SetBackgroundColor(System.Drawing.Color.Orange);
                break;

            case ToastNotificationTypeEnum.Warning:
                config.SetBackgroundColor(System.Drawing.Color.MediumVioletRed);
                break;
            }

            UserDialogs.Instance.Toast(config);
        }
        async Task LookUpPatient(string nfcText)
        {
            var toastConfig = new ToastConfig("Tag gescand");

            toastConfig.SetDuration(1500);
            toastConfig.SetBackgroundColor(System.Drawing.Color.Green);
            toastConfig.SetMessageTextColor(System.Drawing.Color.White);

            UserDialogs.Instance.Toast(toastConfig);
            try
            {
                var foundPatient = await patientService.GetPatient(nfcText);

                allParameters.Add("patient", foundPatient);

                await _navigationService.NavigateAsync("NfcReadPatientTagResultPage", allParameters);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                toastConfig = new ToastConfig("Er is iets misgegaan. Mogelijk is dit geen geldige tag.");
                toastConfig.SetDuration(5000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);

                UserDialogs.Instance.Toast(toastConfig);

                Console.WriteLine(ex.Message);
            }
        }
        public void ShowToast()
        {
            var toastConfig = new ToastConfig(toastMessage);

            toastConfig.SetDuration(3000);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(44, 181, 19));
            toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(0, 0, 0));
            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #8
0
        public void ShowToast(string message, int duration = 5000)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.Position = ToastPosition.Top;
            toastConfig.SetDuration(duration);
            toastConfig.SetMessageTextColor(System.Drawing.Color.White);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(33, 44, 55));
            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #9
0
        public static void ShowToast(string message)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(3000);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(0, 0, 0));
            toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(176, 0, 32));

            UserDialogs.Instance.Toast(toastConfig);
        }
        public int DisplayToast(string message)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(2500);
            toastConfig.SetBackgroundColor(Constants.AccentColor);             //accent color
            toastConfig.SetMessageTextColor(Constants.TextColor);
            _userDialogs.Toast(toastConfig);

            return(2500);
        }
Exemple #11
0
        public static IDisposable Toast(string message, ToastType type)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(3000);

            switch (type)
            {
            case ToastType.Success:
                toastConfig.SetBackgroundColor(System.Drawing.Color.ForestGreen);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);
                break;

            case ToastType.Error:
                toastConfig.SetBackgroundColor(System.Drawing.Color.DarkRed);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);
                break;

            case ToastType.Warning:
                //toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(1, 216, 143, 16));
                toastConfig.SetBackgroundColor(System.Drawing.Color.Orange);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);
                break;

            case ToastType.Info:
                toastConfig.SetBackgroundColor(System.Drawing.Color.LightSkyBlue);
                toastConfig.SetMessageTextColor(System.Drawing.Color.Black);
                break;

            default:
                break;
            }
            toastConfig.SetMessageTextColor(System.Drawing.Color.White);

            var toast = UserDialogs.Instance.Toast(toastConfig);

            return(toast);
        }
        public void ShowToast(string message, int duration, bool topPosition, string image, string textColor, string backgroundColor)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(duration);
            toastConfig.SetMessageTextColor(textColor.ToColor());
            toastConfig.SetBackgroundColor(backgroundColor.ToColor());
            if (!string.IsNullOrWhiteSpace(image))
            {
                toastConfig.SetIcon(image);
            }
            toastConfig.Position = topPosition ? ToastPosition.Top : ToastPosition.Bottom;
            UserDialogs.Instance.Toast(toastConfig);
        }
        //display scan result (success / error) in scan page
        public void displayToast(string message)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(2000);
            toastConfig.Position = 0;
            toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(0, 0, 0));
            if (message == "Job added to job list.")
            {
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(50, 205, 50));
            }

            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #14
0
        /// <summary>
        /// Shows the message.
        /// </summary>
        /// <param name="message">The message.</param>
        public void ShowMessage(string message)
        {
            try
            {
                var toastOptions = new ToastConfig(message);
                toastOptions.SetDuration(TimeSpan.FromSeconds(5));
                toastOptions.SetBackgroundColor(System.Drawing.Color.Red);
                toastOptions.SetPosition(ToastPosition.Bottom);
                toastOptions.SetMessageTextColor(System.Drawing.Color.White);

                UserDialogs.Instance.Toast(message, TimeSpan.FromSeconds(5));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        public void DisplayToast(string message)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(2000);
            toastConfig.Position = 0;
            toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(0, 0, 0));
            if (message == "Success")
            {
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(0, 128, 0));
            }
            else
            {
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(255, 0, 0));
            }
            UserDialogs.Instance.Toast(toastConfig);
        }
        private async Task LookUpSerialNumber(string sn)
        {
            var toastConfig = new ToastConfig("Tag gescand");

            toastConfig.SetDuration(1500);
            toastConfig.SetBackgroundColor(System.Drawing.Color.Green);
            toastConfig.SetMessageTextColor(System.Drawing.Color.White);

            UserDialogs.Instance.Toast(toastConfig);

            try
            {
                var foundDevice = await deviceService.GetDeviceAsync(sn);

                if (IsUnique(foundDevice.sn))
                {
                    DeviceListItems.Add(new DeviceListItem
                    {
                        DeviceName   = foundDevice.name,
                        SerialNumber = foundDevice.sn,
                        DeviceType   = foundDevice.type,
                        DeviceId     = foundDevice._id
                    });
                }
                else
                {
                    toastConfig = new ToastConfig("Dit apparaat is al een keer gescand");
                    toastConfig.SetDuration(1500);
                    toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);
                    toastConfig.SetMessageTextColor(System.Drawing.Color.White);

                    UserDialogs.Instance.Toast(toastConfig);
                }
            }
            catch (ArgumentOutOfRangeException ex)
            {
                toastConfig = new ToastConfig("Er is iets misgegaan. Mogelijk is dit geen geldige tag.");
                toastConfig.SetDuration(5000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);

                UserDialogs.Instance.Toast(toastConfig);

                Console.WriteLine(ex.Message);
            }
        }
Exemple #17
0
        void FinJuego()
        {
            juegoTerminado = true;
            for (int i = 0; i < 4; i++)
            {
                boxview[i].Color = Color.Gray;
            }
            var toastmsm = new ToastConfig("Perdiste");

            toastmsm.SetDuration(3000);
            toastmsm.SetBackgroundColor(System.Drawing.Color.Orange);
            toastmsm.SetMessageTextColor(System.Drawing.Color.White);
            toastmsm.SetPosition(ToastPosition.Bottom);
            UserDialogs.Instance.Toast(toastmsm);
            Empezar.Text      = "Intentar de nuevo";
            Empezar.IsVisible = true;
        }
Exemple #18
0
        public void displayToast(string message)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(2000);
            toastConfig.Position = 0;
            toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(0, 0, 0));
            if (message == "New job added to list")
            {
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(0, 128, 0));
            }
            else if (message == "Job already exist in list")
            {
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(255, 0, 0));
            }
            UserDialogs.Instance.Toast(toastConfig);
        }
        private async void GoToScanPatientNfcTagPage()
        {
            if (DeviceListItems.Count > 0)
            {
                allParameters.Add("deviceList", DeviceListItems);

                await _navigationService.NavigateAsync("NfcReadPatientTagPage", allParameters);
            }
            else
            {
                var toastConfig = new ToastConfig("Scan de tag van minimaal 1 apparaat");
                toastConfig.SetDuration(5000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);
                toastConfig.SetMessageTextColor(System.Drawing.Color.White);

                UserDialogs.Instance.Toast(toastConfig);
            }
        }
        public void ShowToast(string message, int duration = 5000)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(duration);
            toastConfig.Position = ToastPosition.Bottom;

            // ICON
            //toastConfig.SetIcon("icon");

            //toastConfig.SetAction((x) => x.SetText("Action Toast")
            //.SetTextColor(System.Drawing.Color.White));

            toastConfig.SetMessageTextColor(System.Drawing.Color.White);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(33, 44, 55));

            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #21
0
        public void ShowToast(string message, int duration = 5000)
        {
            var toastConfig = new ToastConfig(message);

            toastConfig.SetDuration(duration);
            toastConfig.Position = Device.RuntimePlatform == Device.UWP ? ToastPosition.Top : ToastPosition.Bottom;

            // ICON

            /*
             * var img = "notification_icon.png";
             * var icon = await BitmapLoader.Current.LoadFromResource(img, null, null);
             * toastConfig.SetIcon(icon);
             */

            toastConfig.SetMessageTextColor(System.Drawing.Color.White);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(33, 44, 55));

            UserDialogs.Instance.Toast(toastConfig);
        }
Exemple #22
0
        private static IDisposable CallToast(string message, TimeSpan exibTime, Color?backgroundColor = null,
                                             Color?fontColor = null, string icon = null)
        {
            var toast = new ToastConfig(message);

            toast.SetDuration(exibTime);
            if (backgroundColor.HasValue)
            {
                toast.SetBackgroundColor(backgroundColor.Value);
            }
            if (fontColor.HasValue)
            {
                toast.SetMessageTextColor(fontColor.Value);
            }
            if (icon == string.Empty)
            {
                toast.SetIcon(icon);
            }
            return(UserDialogs.Instance.Toast(toast));
        }
 public static void ShowToast(this Application application, string toast, Color foreColor,
                              Color backColor)
 {
     if (application == null)
     {
         throw new ArgumentNullException(nameof(application));
     }
     if (toast == null)
     {
         throw new ArgumentNullException(nameof(toast));
     }
     Device.BeginInvokeOnMainThread(() =>
     {
         var conf = new ToastConfig(toast);
         conf.SetDuration(1500);
         conf.SetPosition(ToastPosition.Top);
         conf.SetMessageTextColor(foreColor);
         conf.SetBackgroundColor(backColor);
         UserDialogs.Instance.Toast(conf);
     });
 }
Exemple #24
0
        void DisplayScanStatus(string scanStatus)
        {
            try
            {
                var toastConfig = new ToastConfig(scanStatus);
                toastConfig.SetDuration(4000);
                toastConfig.Position = 0;
                toastConfig.SetMessageTextColor(System.Drawing.Color.Black);

                if (scanStatus.Contains("scanned") || scanStatus.Contains("scanning"))
                {
                    toastConfig.SetBackgroundColor(System.Drawing.Color.Green);
                }
                else
                {
                    toastConfig.SetBackgroundColor(System.Drawing.Color.Red);
                }
                UserDialogs.Instance.Toast(toastConfig);
            }
            catch
            {
            }
        }
        void JobContent()
        {
            //get job info from db
            if (jobItem == null)
            {
                jobItem    = App.Database.GetJobRecordAsync(Ultis.Settings.SessionCurrentJobId);
                jobDetails = App.Database.GetDetailsAsync(Ultis.Settings.SessionCurrentJobId);
            }

            //reset the page design
            jobDesc.Children.Clear();
            pointInStack.IsVisible       = false;
            actionIconStack.IsVisible    = true;
            remarkStack.IsVisible        = true;
            TrailerDetailStack.IsVisible = true;
            TrailerStack.IsVisible       = true;

            //display all the job details
            int count = 0;

            foreach (DetailItems detailItem in jobDetails)
            {
                Label label = new Label();

                if (detailItem.Caption == "Pickup" || detailItem.Caption == "Drop-off")
                {
                    label.Text = detailItem.Caption + ":  " + detailItem.Value;
                }
                else if (detailItem.Caption == "")
                {
                    label.Text = detailItem.Value;
                }
                else if (count == 0)
                {
                    label.Text = detailItem.Caption + ":  " + detailItem.Value;
                    count++;
                    jobCode = detailItem.Value;
                }
                else if (detailItem.Caption == "Booking")
                {
                    label.Text  = detailItem.Caption + ":  " + detailItem.Value;
                    bookingCode = detailItem.Value;
                }
                else
                {
                    label.Text = detailItem.Caption + ":  " + detailItem.Value;
                }

                label.FontAttributes = FontAttributes.Bold;
                var tapGestureRecognizer = new TapGestureRecognizer();
                tapGestureRecognizer.Tapped += async(sender, e) =>
                {
                    await Clipboard.SetTextAsync(label.Text);

                    var toastConfig = new ToastConfig("Text Copied");
                    toastConfig.SetDuration(2000);
                    toastConfig.Position = 0;
                    toastConfig.SetMessageTextColor(System.Drawing.Color.FromArgb(0, 0, 0));
                    toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(0, 128, 0));
                    UserDialogs.Instance.Toast(toastConfig);
                };
                label.GestureRecognizers.Add(tapGestureRecognizer);


                StackLayout stackLayout = new StackLayout {
                    Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start, Padding = new Thickness(0, 5, 0, 5)
                };
                stackLayout.Children.Add(label);
                jobDesc.Children.Add(stackLayout);
            }

            map_icon.IsVisible       = (!(String.IsNullOrEmpty(jobItem.Latitude))) ? true : false;
            phone_icon.IsVisible     = (!(String.IsNullOrEmpty(jobItem.TelNo))) ? true : false;
            trailerIDEntry.Text      = jobItem.TrailerId;
            trailerIDEntry.IsEnabled = (!(String.IsNullOrEmpty(jobItem.TrailerId))) ? false : true;

            //indicate which control to be show
            if (!(String.IsNullOrEmpty(jobItem.ActionId)))
            {
                switch (jobItem.ActionId)
                {
                case "EmptyPickup":
                    signatureStack.IsVisible = (jobItem.ReqSign) ? true : false;
                    SplitContainerNumber();
                    break;

                case "Point1_Chk":
                case "Point2_Chk":
                    TrailerDetailStack.IsVisible = false;
                    signatureStack.IsVisible     = (jobItem.ReqSign) ? true : false;
                    SplitContainerNumber();
                    break;

                case "Point1_In":
                case "Point2_In":
                    lblActionMessage.Text        = jobItem.ActionMessage;
                    pointInStack.IsVisible       = true;
                    actionIconStack.IsVisible    = false;
                    remarkStack.IsVisible        = false;
                    TrailerDetailStack.IsVisible = false;
                    TrailerStack.IsVisible       = false;
                    break;
                }
            }

            sealNoEntry.Text = jobItem.SealNo;
            //indicate the seal no is mandatory, optional or read only
            if (jobItem.ActionId == "Point1_Chk" || jobItem.ActionId == "Point2_Chk")
            {
                Device.BeginInvokeOnMainThread(() => {
                    switch (jobItem.SealMode)
                    {
                    case "R":
                        sealNoEntry.IsEnabled = false;
                        break;

                    case "O":
                        sealNoEntry.IsEnabled = true;
                        break;

                    case "M":
                        sealNoEntry.IsEnabled = true;
                        //sealNoEntry.LineColor = Color.LightYellow;
                        sealNoView.ContainerBackgroundColor = Color.LightYellow;
                        break;

                    case "H":
                        sealNoView.IsVisible  = false;
                        sealNoEntry.IsVisible = false;
                        break;
                    }
                });
            }
        }