예제 #1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var id = item.ItemId;

            if (id == Resource.Id.action_about)
            {
                var alert = new AlertDialog.Builder(this);
                alert.SetTitle("关于");
                alert.SetMessage("七天网络第三方查分 App.");
                alert.SetPositiveButton("确定", (senderAlert, args) => { });

                alert.SetNeutralButton("Github",
                                       (senderAlert, args) => { Toast.MakeText(this, "已开源在 Github!", ToastLength.Short).Show(); });


                Dialog dialog = alert.Create();
                dialog.Show();
                return(true);
            }

            if (id == Resource.Id.action_logout)
            {
                GetSharedPreferences("config", FileCreationMode.Private)
                .Edit().PutString("token", "").Apply();
                ShowLoginDialog();
            }

            return(base.OnOptionsItemSelected(item));
        }
예제 #2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.institutions_info);



            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);


            // Create your application here
            FindViewById <FrameLayout>(Resource.Id.progressBarHolder).Visibility = ViewStates.Visible;


            model.db_select select = new model.db_select();

            list = await select.get_institutions(Preferences.Get("cypher1", "").ToString(), Preferences.Get("cypher2", "").ToString());

            //Toast.MakeText(ApplicationContext, list[0].DocAdSoyad, ToastLength.Long).Show();

            listView1 = FindViewById <ListView>(Resource.Id.listView1);
            FindViewById <SearchView>(Resource.Id.searchView1).QueryTextChange += search;
            AD = new List <string>();

            foreach (var item in list)
            {
                AD.Add(item.AD);
            }
            mAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, AD);
            if (!mAdapter.IsEmpty)
            {
                FindViewById <ListView>(Resource.Id.listView1).Adapter = mAdapter;
            }
            else
            {
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                alertDialog.SetTitle("Bildiriş");
                alertDialog.SetMessage("Xəta baş verdi");
                alertDialog.SetNeutralButton("Geriyə", delegate {
                    alertDialog.Dispose();
                });
                alertDialog.Show();
            }

            FindViewById <FrameLayout>(Resource.Id.progressBarHolder).Visibility = ViewStates.Gone;
        }
예제 #3
0
 private void ShowSaveDialog()
 {
     try
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_exit_without_saving_image));
         builder.SetPositiveButton(GetText(Resource.String.Lbl_Save), delegate(object sender, DialogClickEventArgs args) { SaveImage(); });
         builder.SetNegativeButton(GetText(Resource.String.Lbl_Cancel), delegate(object sender, DialogClickEventArgs args) { });
         builder.SetNeutralButton(GetText(Resource.String.Lbl_Discard), delegate(object sender, DialogClickEventArgs args) { var resultIntent = new Intent(); SetResult(Result.Canceled, resultIntent); Finish(); });
         builder.Create().Show();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            Button sendEmail      = FindViewById <Button>(Resource.Id.sendButton);
            Button sendSMS        = FindViewById <Button>(Resource.Id.sendSMSButton);
            Button displayMessage = FindViewById <Button>(Resource.Id.displayMessageButton);

            EditText recipient = FindViewById <EditText>(Resource.Id.email);
            EditText subject   = FindViewById <EditText>(Resource.Id.subject);
            EditText message   = FindViewById <EditText>(Resource.Id.message);

            sendEmail.Click += delegate
            {
                if (recipient.Text.Trim().Length == 0 || subject.Text.Trim().Length == 0 || message.Text.Trim().Length == 0)
                {
                    var dialog = new AlertDialog.Builder(this);
                    dialog.SetTitle("Error");
                    dialog.SetMessage("You must supply a recipient, subject and a message");
                    dialog.SetNeutralButton("OK", (s, a) => { });
                    dialog.Show();
                }
                else
                {
                    var email = new Intent(Intent.ActionSend);
                    email.PutExtra(Intent.ExtraEmail, new string[] { recipient.Text });
                    email.PutExtra(Intent.ExtraSubject, subject.Text);
                    email.PutExtra(Intent.ExtraText, message.Text);
                    email.SetType("message/rfc822");

                    StartActivity(email);
                };
            };

            sendSMS.Click += (sender, args) =>
            {
                string url    = string.Format("smsto:{0}", recipient.Text);
                var    uri    = Android.Net.Uri.Parse(url);
                var    intent = new Intent(Intent.ActionSendto, uri);
                intent.PutExtra("sms_body", message.Text);
                StartActivity(intent);
            };
        }
예제 #5
0
        private void ProfileAction(object sender, System.EventArgs e)
        {
            AlertDialog.Builder profileAlert = new AlertDialog.Builder(this);
            profileAlert.SetTitle("Profile");
            profileAlert.SetMessage("What would you like to do?");


            profileAlert.SetPositiveButton("Register", (senderAlert, arg) => RegisterClass.Alert(this));
            profileAlert.SetNeutralButton("Login", (sendingAlert, arg) => LoginClass.Alert(this));
            profileAlert.SetNegativeButton("Logout", async(sendingAlert, arg) => await LogoutClass.Logout(this));


            Dialog dialog = profileAlert.Create();

            dialog.Window.SetGravity(GravityFlags.Bottom);
            dialog.Show();
        }
예제 #6
0
        public Dialog Build(Activity activity, ActionSheetConfig config)
        {
            var dialog = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                         .SetTitle(config.Title);

            if (config.Cancel != null)
            {
                dialog.SetNeutralButton(config.Cancel.Text, (s, a) =>
                {
                    config.Cancel.Action?.Invoke();
                });
            }

            if (config.Destructive != null)
            {
                dialog.SetNegativeButton(config.Destructive.Text, (s, a) =>
                {
                    config.Destructive.Action?.Invoke();
                });
            }

            if (config.Items != null && config.Items.Count > 0)
            {
                if (config.Items.Any(t => t.ItemIcon != null))
                {
                    var array = config.Items.Select(t => t.Text).ToArray();

                    dialog.SetItems(array, (s, a) =>
                    {
                        config.Items[a.Which].Action?.Invoke();
                    });
                }
                else
                {
                    var adapter = new ActionSheetListAdapter(activity, global::Android.Resource.Layout.SelectDialogItem, global::Android.Resource.Id.Text1, config);

                    dialog.SetAdapter(adapter, (s, a) =>
                    {
                        config.Items[a.Which].Action?.Invoke();
                    });
                }
            }

            return(dialog.Create());
        }
예제 #7
0
 public void ShowSaveDialog()
 {
     try
     {
         var builder = new AlertDialog.Builder(this);
         builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_exit_without_saving_image));
         builder.SetPositiveButton(GetText(Resource.String.Lbl_Save), delegate
         {
             SaveImage();
         });
         builder.SetNegativeButton(GetText(Resource.String.Lbl_Cancel), delegate { });
         builder.SetNeutralButton(GetText(Resource.String.Lbl_Discard), delegate { var resultIntent = new Intent(); SetResult(Result.Canceled, resultIntent); Finish(); });
         builder.Create().Show();
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
예제 #8
0
        public void GetJsonData()
        {
            try
            {
                var    assembly = typeof(MainActivity).GetTypeInfo().Assembly;
                Stream stream   = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.slangWordsList.json");

                using (var reader = new StreamReader(stream))
                {
                    var json = reader.ReadToEnd();
                    var myDeserializedClass = JsonConvert.DeserializeObject <List <MatchedWord> >(json);

                    if (editTextInput.Text.Equals(myDeserializedClass[0].SlangWord, StringComparison.OrdinalIgnoreCase))
                    {
                        showResult.Text = myDeserializedClass[0].Description;
                    }
                    else if (editTextInput.Text.Equals(myDeserializedClass[1].SlangWord, StringComparison.OrdinalIgnoreCase))
                    {
                        showResult.Text = myDeserializedClass[1].Description;
                    }
                    else if (editTextInput.Text.Equals(myDeserializedClass[2].SlangWord, StringComparison.OrdinalIgnoreCase))
                    {
                        showResult.Text = myDeserializedClass[2].Description;
                    }
                    else
                    {
                        showResult.Text = Constants.NoMatch;
                    }
                }
            }
            catch (Exception ex)
            {
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                alertDialog.SetTitle(Constants.Error);
                alertDialog.SetMessage(Constants.ErrorNotify + ex.Message);
                alertDialog.SetNeutralButton(Constants.Ok, delegate
                {
                    alertDialog.Dispose();
                });
                alertDialog.Show();
            }
        }
예제 #9
0
        public static AlertDialog.Builder Build(Activity activity, ActionSheetConfig config)
        {
            var dlg = new AlertDialog
                      .Builder(activity)
                      .SetCancelable(false)
                      .SetTitle(config.Title);

            //.SetCustomTitle(new TextView(activity) {
            //    Text = config.Title,
            //    TextSize = 18.0f
            //});

            if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null))
            {
                var adapter = new ActionSheetListAdapter(activity, Android.Resource.Layout.SelectDialogItem,
                                                         Android.Resource.Id.Text1, config);
                dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke());
            }
            else
            {
                var array = config
                            .Options
                            .Select(x => x.Text)
                            .ToArray();

                dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());
            }

            if (config.Destructive != null)
            {
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());
            }

            if (config.Cancel != null)
            {
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());
            }

            return(dlg);
        }
예제 #10
0
        public override void ActionSheet(ActionSheetConfig config)
        {
            var array = config
                .Options
                .Select(x => x.Text)
                .ToArray();

            var dlg = new AlertDialog
                .Builder(this.GetTopActivity())
                .SetCancelable(false)
                .SetTitle(config.Title);

            dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());

            if (config.Destructive != null)
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());

            if (config.Cancel != null)
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());

            Utils.RequestMainThread(() => dlg.ShowExt());
        }
예제 #11
0
        public Dialog Build(Activity activity, AlertConfig config)
        {
            var builder = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title);

            if (config.OkButton != null)
            {
                builder.SetPositiveButton(config.OkButton.Text, (o, e) => config.OkButton.Action?.Invoke());
            }

            if (config.CancelButton != null)
            {
                builder.SetNegativeButton(config.CancelButton.Text, (o, e) => config.CancelButton.Action?.Invoke());
            }

            if (config.DestructiveButton != null)
            {
                builder.SetNeutralButton(config.DestructiveButton.Text, (o, e) => config.DestructiveButton.Action?.Invoke());
            }

            return(builder.Create());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Kp2aLog.Log("ChooseForAutofillActivityBase.OnCreate");
            base.OnCreate(savedInstanceState);

            //if launched from history, don't re-use the task. Proceed to FileSelect instead.
            if (Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory))
            {
                Kp2aLog.Log("ChooseForAutofillActivityBase: started from history");
                Kp2aLog.Log("Forwarding to FileSelect. QueryCredentialsActivity started from history.");
                RestartApp();
                return;
            }

            string requestedUrl = Intent.GetStringExtra(ExtraQueryString);

            if (requestedUrl == null)
            {
                Kp2aLog.Log("ChooseForAutofillActivityBase: no requestedUrl ");
                Toast.MakeText(this, "Cannot execute query for null.", ToastLength.Long).Show();
                RestartApp();
                return;
            }

            if (Intent.HasExtra(ExtraDisplayWarning))
            {
                AutofillServiceBase.DisplayWarning warning =
                    (AutofillServiceBase.DisplayWarning)Intent.GetIntExtra(ExtraDisplayWarning, (int)AutofillServiceBase.DisplayWarning.None);
                Kp2aLog.Log("ChooseForAutofillActivityBase: ExtraDisplayWarning = " + warning);
                if (warning != AutofillServiceBase.DisplayWarning.None)
                {
                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle(this.GetString(Resource.String.AutofillWarning_title));

                    string appName            = Intent.GetStringExtra(ExtraQueryPackageString);
                    string appNameWithPackage = appName;
                    try
                    {
                        var appInfo = PackageManager.GetApplicationInfo(appName, 0);
                        if (appInfo != null)
                        {
                            appName            = PackageManager.GetApplicationLabel(appInfo);
                            appNameWithPackage = appName + " (" + Intent.GetStringExtra(ExtraQueryPackageString) + ")";
                        }
                    }
                    catch (Exception)
                    {
                        // ignored
                    }

                    builder.SetMessage(
                        GetString(Resource.String.AutofillWarning_Intro, new Java.Lang.Object[]
                    {
                        Intent.GetStringExtra(ExtraQueryDomainString), appNameWithPackage
                    })
                        + " " +
                        this.GetString(Resource.String.AutofillWarning_FillDomainInUntrustedApp, new Java.Lang.Object[]
                    {
                        Intent.GetStringExtra(ExtraQueryDomainString), appName
                    }));

                    builder.SetPositiveButton(this.GetString(Resource.String.Continue),
                                              (dlgSender, dlgEvt) =>
                    {
                        new Kp2aDigitalAssetLinksDataSource(this).RememberTrustedLink(Intent.GetStringExtra(ExtraQueryDomainString),
                                                                                      Intent.GetStringExtra(ExtraQueryPackageString));
                        Proceed();
                    });
                    builder.SetNeutralButton(this.GetString(Resource.String.AutofillWarning_trustAsBrowser, new Java.Lang.Object[]
                                                            { appName }),
                                             (sender, args) =>
                    {
                        new Kp2aDigitalAssetLinksDataSource(this).RememberAsTrustedApp(Intent.GetStringExtra(ExtraQueryPackageString));
                        Proceed();
                    });

                    builder.SetNegativeButton(this.GetString(Resource.String.cancel), (dlgSender, dlgEvt) =>
                    {
                        Finish();
                    });


                    Dialog dialog = builder.Create();
                    dialog.Show();
                    return;
                }
            }
            else
            {
                Kp2aLog.Log("ChooseForAutofillActivityBase: No ExtraDisplayWarning");
            }
            Proceed();
        }
예제 #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.axtarish_param);
            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar2);

            SetSupportActionBar(toolbar);


            SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("r_id")))
            {
                FindViewById <Button>(Resource.Id.button2).Enabled = true;
                // Toast.MakeText(this, Intent.GetStringExtra("m_id"), ToastLength.Long).Show();
                FindViewById <Button>(Resource.Id.button1).Text = Intent.GetStringExtra("r_name");
            }

            if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("m_id")))
            {
                FindViewById <Button>(Resource.Id.button2).Enabled = true;
                // Toast.MakeText(this, Intent.GetStringExtra("r_id")+" "+Intent.GetStringExtra("m_id"), ToastLength.Long).Show();

                FindViewById <Button>(Resource.Id.button1).Text = Intent.GetStringExtra("r_name");
                FindViewById <Button>(Resource.Id.button2).Text = Intent.GetStringExtra("m_name");
            }
            FindViewById <Button>(Resource.Id.button1).Click += delegate
            {
                //Выбор города

                //FindViewById<Button>(Resource.Id.button2).Text = "Tibb müəssisəsini daxil edin...";
                Finish();
                Intent regionlar = new Intent(this, typeof(Regionlar));
                regionlar.PutExtra("data", Intent.GetStringExtra("data"));

                StartActivity(regionlar);
            };
            FindViewById <Button>(Resource.Id.button2).Click += delegate
            {
                //Выбор региона

                Finish();
                Intent mues = new Intent(this, typeof(muessiseler));
                mues.PutExtra("data", Intent.GetStringExtra("data"));

                mues.PutExtra("r_id", Intent.GetStringExtra("r_id"));
                mues.PutExtra("r_name", Intent.GetStringExtra("r_name"));
                StartActivity(mues);
            };
            FindViewById <Button>(Resource.Id.button3).Click += delegate
            {
                //Кнопка поиска
                if (FindViewById <EditText>(Resource.Id.editText1).Text != "" || FindViewById <EditText>(Resource.Id.editText2).Text != "")

                {
                    Intent hekimler = new Intent(this, typeof(hekimler));
                    hekimler.PutExtra("data", Intent.GetStringExtra("data"));

                    hekimler.PutExtra("r_id", Intent.GetStringExtra("r_id"));
                    hekimler.PutExtra("m_id", Intent.GetStringExtra("m_id"));
                    hekimler.PutExtra("ad", FindViewById <EditText>(Resource.Id.editText1).Text);
                    hekimler.PutExtra("soyad", FindViewById <EditText>(Resource.Id.editText2).Text);
                    StartActivity(hekimler);
                }
                else

                {
                    if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("r_id")))
                    {
                        if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("m_id")))
                        {
                            Intent vezifeler = new Intent(this, typeof(vezifeler));
                            vezifeler.PutExtra("data", Intent.GetStringExtra("data"));

                            vezifeler.PutExtra("r_id", Intent.GetStringExtra("r_id"));
                            vezifeler.PutExtra("m_id", Intent.GetStringExtra("m_id"));
                            StartActivity(vezifeler);
                        }
                        else
                        {
                            AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                            alertDialog.SetTitle("Bildiriş");
                            alertDialog.SetMessage("Axtarışa başlamaq üçün minimum 2 axtarış parametri seçin");
                            alertDialog.SetNeutralButton("Yaxşı", delegate
                            {
                                alertDialog.Dispose();
                            });
                            alertDialog.Show();
                        }
                    }
                    else
                    {
                        AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                        alertDialog.SetTitle("Bildiriş");
                        alertDialog.SetMessage("Axtarışa başlamaq üçün regionu seçin");
                        alertDialog.SetNeutralButton("Yaxşı", delegate
                        {
                            alertDialog.Dispose();
                        });
                        alertDialog.Show();
                    }
                }
            };
        }