Example #1
0
        private void ShowReceived(string message)
        {
            if (!String.IsNullOrWhiteSpace(message))
            {
                var toastConfig = new ToastConfig(message);
                toastConfig.SetPosition(ToastPosition.Bottom);
                toastConfig.SetDuration(NotificationMilliseconds);
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(12, 131, 193));

                Debug.WriteLine(message);

                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);
        }
Example #3
0
        // Register account
        public async Task <bool> RegisterUserAsync(
            string email,
            string password,
            string confirmPassword,
            string firstName,
            string lastName,
            string teamName,
            string teamCode,
            DateTime accountDate)
        {
            var client = new HttpClient();
            var model  = new Register
            {
                Email           = email,
                Password        = password,
                FirstName       = firstName,
                LastName        = lastName,
                TeamName        = teamName,
                ConfirmPassword = confirmPassword,
                TeamCode        = teamCode,
                AccountDate     = accountDate
            };

            var json = JsonConvert.SerializeObject(model);

            HttpContent httpContent = new StringContent(json);

            httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var response = await client.PostAsync(
                Constants.BaseApiAddress + "api/Account/Register", httpContent);

            if (response.IsSuccessStatusCode)
            {
                using (UserDialogs.Instance.Loading("Hang on...", null, null, true, MaskType.Black))
                {
                    ToastConfig toastConfig = new ToastConfig("Your account has been successfully registered!");
                    toastConfig.SetDuration(4000);
                    toastConfig.SetBackgroundColor(Color.OrangeRed);
                    UserDialogs.Instance.Toast(toastConfig);
                }
                return(true);
            }

            Console.WriteLine(response);

            await UserDialogs.Instance.AlertAsync("Something went wrong, please try again", "Uh oh!", "Ok");

            return(false);
        }
        private async Task AcceptInvitation()
        {
            var loadingDialog = DialogService.Loading("Proccessing");

            this.IsBusy = true;
            if (_invitation != null)
            {
                try
                {
                    var agentContext = await _mobileAgentProvider.GetContextAsync();

                    if (agentContext == null)
                    {
                        loadingDialog.Hide();
                        DialogService.Alert("Failed to decode invitation!");
                        return;
                    }
                    var(requestMessage, connectionRecord) = await _connectionService.CreateRequestAsync(agentContext, _invitation);

                    var provisioningRecord = await _provisioningService.GetProvisioningAsync(agentContext.Wallet);

                    var isEndpointUriAbsent = provisioningRecord.Endpoint.Uri == null;

                    var respone = await _messageService.SendReceiveAsync <ConnectionResponseMessage>(agentContext.Wallet, requestMessage, connectionRecord);

                    if (isEndpointUriAbsent)
                    {
                        string processRes = await _connectionService.ProcessResponseAsync(agentContext, respone, connectionRecord);
                    }
                    loadingDialog.Hide();
                    await NavigationService.CloseAllPopupsAsync();

                    var toastConfig = new ToastConfig("Connection Saved!");
                    toastConfig.BackgroundColor = Color.Green;
                    toastConfig.Position        = ToastPosition.Top;
                    toastConfig.SetDuration(3000);
                    DialogService.Toast(toastConfig);
                    _eventAggregator.Publish(new ApplicationEvent()
                    {
                        Type = ApplicationEventType.ConnectionsUpdated
                    });
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.ToString());
                    loadingDialog.Hide();
                    DialogService.Alert("Something went wrong!");
                }
            }
        }
        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);
        }
Example #6
0
        private void StartButtonClicked()
        {
            try
            {
                _speechRecognitionInstance.StartSpeechToText();
            }
            catch (Exception ex)
            {
                var toastConfig = new ToastConfig("Er is iets mis gegaan bij het opnemen. Neem contact op wanneer dit blijft gebeuren");
                toastConfig.SetDuration(5000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.Firebrick);

                UserDialogs.Instance.Toast(toastConfig);
            }
        }
Example #7
0
        void SendContact()
        {
            using (SmtpClient cliente = new SmtpClient("smtp.live.com", 25))
            {
                cliente.EnableSsl   = true;
                cliente.Credentials = new NetworkCredential("*****@*****.**", "espiritusanto2020");
                MailMessage mensaje = new MailMessage("*****@*****.**", "*****@*****.**", "Contacto de " + Nombre, "Correo: " + Correo + "\n Celular: " + Celular + "\n Asunto: " + Asunto + "\n Mensaje: " + Mensaje);
                cliente.Send(mensaje);
            }
            var toastConfig = new ToastConfig("Enviado");

            toastConfig.SetDuration(4000);
            toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(33, 150, 243));

            UserDialogs.Instance.Toast(toastConfig);
        }
Example #8
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);
        }
        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);
        }
Example #10
0
 public void Toast(string msg)
 {
     try
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             var toastConfig = new ToastConfig(msg);
             toastConfig.SetDuration(3000);
             toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(12, 131, 193));
             UserDialogs.Instance.Toast(toastConfig);
         });
     }
     catch (Exception e)
     {
         new Exception(e.Message);
     }
 }
        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);
            }
        }
Example #12
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);
            }
        }
        async void AddToGrid(object sender, System.EventArgs e)
        {
            try
            {
                if (!(String.IsNullOrEmpty(SKUEntry.Text)) && !(String.IsNullOrEmpty(SKUEntry.Text)))
                {
                    clsWhsItem item = new clsWhsItem
                    {
                        ProductCode = SKUEntry.Text,
                        LoadQty     = Convert.ToInt32(QtyEntry.Text)
                    };

                    bool existItem = items.Any(check => check.ProductCode == item.ProductCode);

                    if (existItem == false)
                    {
                        items.Add(item);
                        itemsTest.Add(item);

                        dataGrid.ItemsSource = items;
                        dataGrid.ItemsSource = itemsTest;

                        SKUEntry.Text = String.Empty;
                        QtyEntry.Text = String.Empty;

                        var toastConfig = new ToastConfig("Added to the list");
                        toastConfig.SetDuration(3000);
                        toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(0, 128, 0));
                        toastConfig.SetPosition(0);
                        UserDialogs.Instance.Toast(toastConfig);
                    }
                    else
                    {
                        await DisplayAlert("Duplicate", "Item added to list.", "OK");
                    }
                }
                else
                {
                    await DisplayAlert("Missing field", "Please enter all field.", "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
Example #14
0
        public void ShowToast(string text, ToastType toastType = ToastType.NORMAL, int duration = 3000)
        {
            var toastConfig = new ToastConfig(text);

            toastConfig.SetDuration(duration);
            switch (toastType)
            {
            case ToastType.SUCCESS:
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(75, 181, 67));
                break;

            case ToastType.ERROR:
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(255, 0, 51));
                break;
            }
            UserDialogs.Instance.Toast(toastConfig);
        }
Example #15
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;
        }
Example #16
0
        private async void checkCreds()
        {
            try
            {
                var httpClient = new HttpClient();

                var payload = "{\"email\": \"" + this.Email + "\"," +
                              "\"password\": \"" + this.password + "\"" +
                              "}";
                var                 url    = new Uri(App.BaseApiUrl + "/users/login");
                HttpContent         c      = new StringContent(payload, Encoding.UTF8, "application/json");
                HttpResponseMessage result = await httpClient.PostAsync(url, c);

                System.Diagnostics.Debug.WriteLine(result.Content.ReadAsStringAsync().Result);
                var users = JsonConvert.DeserializeObject <List <RestUserModel> >(result.Content.ReadAsStringAsync().Result);
                loading = false;
                if (users.Count == 1)
                {
                    Application.Current.Properties["userEmail"]    = users[0].Email;
                    Application.Current.Properties["userID"]       = users[0].Id;
                    Application.Current.Properties["userImage"]    = users[0].Image;
                    Application.Current.Properties["userFullName"] = users[0].FirstName + " " + users[0].LastName;
                    Application.Current.Properties["userPhone"]    = users[0].Phone;

                    await Application.Current.SavePropertiesAsync();

                    await Task.Delay(2000);

                    var recentChatPage = new Views.Chat.RecentChatPage();
                    await Application.Current.MainPage.Navigation.PushAsync(recentChatPage);
                }
                else
                {
                    var toastConfig = new ToastConfig("Email or Password is invalid!");
                    toastConfig.SetDuration(3000);
                    toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(242, 76, 101));
                    UserDialogs.Instance.Toast(toastConfig);
                }
            }
            catch (Exception e)
            {
                loading = false;
                System.Diagnostics.Debug.WriteLine("E: " + e);
            }
        }
        private async Task AcceptProofRequest()
        {
            var loadingDialog = DialogService.Loading("Proccessing");

            try
            {
                this.IsBusy = true;
                var context = await _agentProvider.GetContextAsync();

                var(message, proofRecord) = await _proofService.CreatePresentationAsync(context, ProofRequestRecord.Id, RequestedCredentials);

                var connectionRecord = await _connectionService.GetAsync(context, proofRecord.ConnectionId);

                await _messageService.SendAsync(context.Wallet, message, connectionRecord);

                loadingDialog.Hide();
                this.IsBusy = false;
                await NavigationService.NavigateBackAsync();

                var toastConfig = new ToastConfig("Accepted Proof!");
                toastConfig.BackgroundColor = Color.Green;
                toastConfig.Position        = ToastPosition.Top;
                toastConfig.SetDuration(3000);
                DialogService.Toast(toastConfig);
            }
            catch (IndyException e)
            {
                this.IsBusy = false;
                loadingDialog.Hide();
                if (e.SdkErrorCode == 212)
                {
                    DialogService.Alert("You don't have any suitable credential to present", "Error", "OK");
                }
                else
                {
                    DialogService.Alert("Some error with libindy. We're working on it", "Error", "OK");
                }
            }
            catch (Exception e)
            {
                this.IsBusy = false;
                loadingDialog.Hide();
                DialogService.Alert("Error while accept Proof Request");
            }
        }
        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);
        }
        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);
            }
        }
Example #20
0
        //prompt notification when receive new job notification
        public static void NewJobNotification(ContentPage page)
        {
            try
            {
                pages = page;

                var toastConfig = new ToastConfig("New job available in the job list.");
                toastConfig.SetDuration(6000);
                toastConfig.SetPosition(ToastPosition.Top);
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(12, 131, 193));
                UserDialogs.Instance.Toast(toastConfig);

                CreateToolBarItem(page);
            }
            catch
            {
                pages.DisplayAlert("Error", "Notification error", "OK");
            }
        }
Example #21
0
        public static ToastConfig DisplayToastEnum(ToastType ttype, string text)
        {
            var toastConfig = new ToastConfig(text);

            toastConfig.SetDuration(5000);
            Color color = new Color();

            toastConfig.SetPosition(ToastPosition.Top);
            if (ttype == ToastType.Success)
            {
                color = Color.Green;
            }
            else if (ttype == ToastType.Failure)
            {
                color = Color.MediumVioletRed;
            }
            toastConfig.SetBackgroundColor(color);
            return(toastConfig);
        }
 private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(viewModel.IsBusy))
     {
         if (viewModel.IsBusy)
         {
             UserDialogs.Instance.ShowLoading("正在查询。。。", MaskType.Black);
         }
         else
         {
             UserDialogs.Instance.HideLoading();
         }
     }
     else if (e.PropertyName == nameof(viewModel.Error) && viewModel.Error != null)
     {
         var toastConfig = new ToastConfig(viewModel.Error.Description);
         toastConfig.SetDuration(3000);
         UserDialogs.Instance.Toast(toastConfig);
     }
 }
Example #23
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);
        }
Example #24
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);
     });
 }
Example #26
0
        private async Task CreateAgent(string agentName)
        {
            Preferences.Set(Constants.PoolConfigurationName, _walletConfiguration.PoolConfigurationName);
            var dialog = UserDialogs.Instance.Loading("Creating wallet");

            IsBusy = true;
            try
            {
                _options.AgentName = agentName;
                _options.WalletConfiguration.Id = Constants.LocalWalletIdKey;
                _options.WalletCredentials.Key  = await SyncedSecureStorage.GetOrCreateSecureAsync(
                    key : Constants.LocalWalletCredentialKey,
                    value : Utils.Utils.GenerateRandomAsync(32));

                await _edgeProvisioningService.ProvisionAsync(_options);

                Preferences.Set("LocalWalletProvisioned", true);
                await NavigationService.NavigateToAsync <MainViewModel>();

                dialog?.Hide();
                dialog?.Dispose();
                var toastConfig = new ToastConfig("Successfully created wallet");
                toastConfig.BackgroundColor = Color.Green;
                toastConfig.Position        = ToastPosition.Top;
                toastConfig.SetDuration(3000);
                DialogService.Toast(toastConfig);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex, "Wasn't able to provision the agent");
                dialog?.Hide();
                dialog?.Dispose();
                DialogService.Alert("Failed to create wallet!");
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #27
0
 public void ShowMessage(string message, bool error)
 {
     Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
     {
         var toastConfig = new ToastConfig(message);
         toastConfig.SetDuration(1500);
         if (error)
         {
             toastConfig.SetBackgroundColor(System.Drawing.Color.Red);
         }
         else
         {
             toastConfig.SetBackgroundColor(System.Drawing.Color.LimeGreen);
         }
         toastConfig.MessageTextColor = System.Drawing.Color.White;
         toastConfig.SetPosition(ToastPosition.Bottom);
         Device.BeginInvokeOnMainThread(() =>
         {
             UserDialogs.Instance.Toast(toastConfig);
         });
     });
 }
Example #28
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);
        }
Example #29
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
            {
            }
        }
Example #30
0
        private void buttonClicked(object sender, EventArgs e)
        {
            String username = etUser.Text;

            if (username != string.Empty)
            {
                ISharedPreferences       pref   = Application.Context.GetSharedPreferences("Username", FileCreationMode.Private);;
                ISharedPreferencesEditor editor = pref.Edit();
                editor.PutString("Username", username);
                editor.Apply();        // applies changes asynchronously on newer APIs
                Intent intent = new Intent(this, typeof(MainActivity));
                this.StartActivity(intent);
                this.Finish();
            }
            else
            {
                var toastConfig = new ToastConfig("Fill username!");
                toastConfig.SetDuration(3000);
                toastConfig.SetBackgroundColor(System.Drawing.Color.FromArgb(12, 131, 193));

                UserDialogs.Instance.Toast(toastConfig);
            }
        }