Пример #1
0
        void RefreshItemDetail(Int64 itemID)
        {
            string itemDetailURL = String.Format("{0}/itemdetail.php?id={1}", MainActivity.BASE_URL, itemID.ToString().Replace(",", ""));

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetItemDetail;
            worker.RunWorkerAsync(itemDetailURL);
        }
        void RefreshStations()
        {
            string stationInventoryURL = String.Format("{0}/stationinventory.php", MainActivity.BASE_URL);

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetStationInventory;
            worker.RunWorkerAsync(stationInventoryURL);
        }
Пример #3
0
        void RefreshItems()
        {
            string itemStocksURL = String.Format("{0}/itemstocks.php", MainActivity.BASE_URL);

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetItemStocks;
            worker.RunWorkerAsync(itemStocksURL);
        }
Пример #4
0
        void RefreshPilotList()
        {
            string pilotsOnlineURL = String.Format("{0}/onlinepilots.php", MainActivity.BASE_URL);

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetOnlinePilots;
            worker.RunWorkerAsync(pilotsOnlineURL);
        }
Пример #5
0
        void RefreshPilotDetail(Int64 pilotID)
        {
            //TODO: Remove workaround for Int64.ToString() problem
            string pilotProfileURL = String.Format("{0}/pilotprofile.php?id={1}", MainActivity.BASE_URL, pilotID.ToString().Replace(",", ""));

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetProfile;
            worker.RunWorkerAsync(pilotProfileURL);
        }
Пример #6
0
        private void RefreshPilotByName(string pilotName)
        {
            string pilotProfileURL = String.Format("{0}/pilotprofile.php?name={1}", MainActivity.BASE_URL, pilotName);

            pd = new ProgressDialog(this);
            pd.SetTitle("Loading...");
            pd.SetMessage("Please wait while loading...");
            pd.SetCancelable(false);
            pd.SetIndeterminate(true);
            pd.Show();

            var worker = new BackgroundWorker();
            worker.DoWork += OnGetProfile;
            worker.RunWorkerAsync(pilotProfileURL);
        }
Пример #7
0
        protected override Dialog OnCreateDialog(int id)
        {
            base.OnCreateDialog (id);
            Activity activity = this;
            AlertDialog alertDialog;
            ProgressDialog progressDialog = new ProgressDialog(this);
            SyncService currentService = SyncManager.getInstance().getCurrentService();
            string serviceDescription = currentService.getDescription();
            AlertDialog.Builder builder = new AlertDialog.Builder(this);

            switch(id) {
                case DIALOG_SYNC:
                    progressDialog.SetIndeterminate(true);
                    progressDialog.SetTitle(string.Format(GetString(Resource.String.syncing),serviceDescription));
                    progressDialog.SetMessage(dialogstring);
            //					progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            //
            //						public void onCancel(DialogInterface dialog) {
            //							SyncManager.getInstance().cancel();
            //						}
            //
            //					});
            //					progressDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, GetString(Resource.String.cancel), new DialogInterface.OnClickListener() {
            //						public void onClick(DialogInterface dialog, int which) {
            //							progressDialog.cancel();
            //						}
            //					});
                    return progressDialog;
                case DIALOG_AUTH_PROGRESS:
                    authProgressDialog = new ProgressDialog(this);
                    authProgressDialog.SetTitle("");
                    authProgressDialog.SetMessage(GetString(Resource.String.prefSyncCompleteAuth));
                    authProgressDialog.SetIndeterminate(true);
                    authProgressDialog.SetCancelable(false);
                    return authProgressDialog;
                case DIALOG_ABOUT:
                    // grab version info
                    string ver;
                    try {
                    ver = PackageManager.GetPackageInfo(PackageName, 0).VersionName;
                    } catch (NameNotFoundException e) {
                        e.PrintStackTrace();
                        ver = "Not found!";
                        return null;
                    }

                    // format the string
                    string aboutDialogFormat = GetString(Resource.String.strAbout);
                    string aboutDialogStr = string.Format(aboutDialogFormat, GetString(Resource.String.app_desc), // App description
                            GetString(Resource.String.author), // Author name
                            ver // Version
                            );

                    // build and show the dialog
                    var ad = new AlertDialog.Builder(this).SetMessage(aboutDialogStr)
                                                          .SetTitle(Resources.GetString(GetString (Resource.String.btnProjectPage)))
                                                  		  .SetIcon(Resource.Drawable.Icon)
                        ;

            //							.setNegativeButton(GetString(Resource.String.btnProjectPage), new OnClickListener() {
            //								public void onClick(DialogInterface dialog, int which) {
            //									StartActivity(new Intent(Intent.ACTION_VIEW, Uri
            //											.Parse(Tomdroid.PROJECT_HOMEPAGE)));
            //									dialog.dismiss();
            //								}
            //							}).setPositiveButton(GetString(Resource.String.btnOk), new OnClickListener() {
            //								public void onClick(DialogInterface dialog, int which) {
            //									dialog.dismiss();
            //								}
                    return ad.Create();
                case DIALOG_FIRST_RUN:
            //					.setNeutralButton(GetString(Resource.String.btnOk), new OnClickListener() {
            //						public void onClick(DialogInterface dialog, int which) {
            //							Preferences.putBoolean(Preferences.Key.FIRST_RUN, false);
            //							dialog.dismiss();
            //						}
            //					})

                var adFirstRun = new AlertDialog.Builder(this).SetMessage(Resources.GetString(Resource.String.strWelcome))
                                                      .SetTitle(Resources.GetString(Resource.String.titleWelcome))
                        .SetIcon(Resource.Drawable.Icon);
                return adFirstRun.Create();
                case DIALOG_NOT_FOUND:
                    addCommonNoteNotFoundDialogElements(builder);
                    return builder.Create();
                case DIALOG_NOT_FOUND_SHORTCUT:
                    addCommonNoteNotFoundDialogElements(builder);
                    Intent removeIntent = new NoteViewShortcutsHelper(this).getRemoveShortcutIntent(dialogstring, uri);
            //			        builder.setPositiveButton(GetString(Resource.String.btnRemoveShortcut), new OnClickListener() {
            //			            public void onClick(DialogInterface dialogInterface, readonly int i) {
            //			                sendBroadcast(removeIntent);
            //			                Finish();
            //			            }
            //			        });
                    return builder.Create();
                case DIALOG_PARSE_ERROR:
                    return new AlertDialog.Builder(this)
                    .SetMessage(GetString(Resource.String.messageErrorNoteParsing))
                    .setTitle(GetString(Resource.String.error))
            //					.setNeutralButton(GetString(Resource.String.btnOk), new OnClickListener() {
            //						public void onClick(DialogInterface dialog, int which) {
            //							showNote(true);
            //						}})
                    .create();
                case DIALOG_REVERT_ALL:
                    return new AlertDialog.Builder(this)
                    .SetIcon(Resource.Drawable.ic_dialog_alert)
                    .setTitle(Resource.String.revert_notes)
                    .setMessage(Resource.String.revert_notes_message)
            //			    	.setPositiveButton(GetString(Resource.String.yes), new OnClickListener() {
            //
            //			            public void onClick(DialogInterface dialog, int which) {
            //			        		Preferences.putLong(Preferences.Key.LATEST_SYNC_REVISION, 0);
            //			        		Preferences.putstring(Preferences.Key.LATEST_SYNC_DATE, new Time().Format3339(false));
            //			            	startSyncing(false);
            //			           }
            //
            //			        })
                    .setNegativeButton(Resource.String.no, null)
                    .create();
                case DIALOG_CONNECT_FAILED:
                    return new AlertDialog.Builder(this)
                    .SetMessage(GetString(Resource.String.prefSyncConnectionFailed))
            //					.setNeutralButton(GetString(Resource.String.btnOk), new OnClickListener() {
            //						public void onClick(DialogInterface dialog, int which) {
            //							dialog.dismiss();
            //						}})
                    .create();
                case DIALOG_DELETE_NOTE:
                    return new AlertDialog.Builder(this)
                    .SetIcon(Resource.Drawable.ic_dialog_alert)
                    .setTitle(Resource.String.delete_note)
                    .setMessage(Resource.String.delete_message)
                    .setPositiveButton(GetString(Resource.String.yes), null)
                    .setNegativeButton(Resource.String.no, null)
                    .create();
                case DIALOG_REVERT_NOTE:
                    return new AlertDialog.Builder(this)
                    .SetIcon(Resource.Drawable.ic_dialog_alert)
                    .setTitle(Resource.String.revert_note)
                    .setMessage(Resource.String.revert_note_message)
                    .setPositiveButton(GetString(Resource.String.yes), null)
                    .setNegativeButton(Resource.String.no, null)
                    .create();
                case DIALOG_SYNC_ERRORS:
                    return new AlertDialog.Builder(activity)
                    .SetTitle(Resources.GetString(Resource.String.error))
                    .SetMessage(dialogstring)
                    .SetPositiveButton(Resources.GetString(Resource.String.yes), null)
            //					.setNegativeButton(GetString(Resource.String.close), new OnClickListener() {
            //						public void onClick(DialogInterface dialog, int which) { finishSync(); }
            //					})
                    .create();
                case DIALOG_SEND_CHOOSE:
                    Uri intentUri = Uri.Parse(dialogstring);
                    return new AlertDialog.Builder(activity)
                    .SetMessage(GetString(Resource.String.sendChoice))
                    .SetTitle(GetString(Resource.String.sendChoiceTitle))
                    .SetPositiveButton(Resources.GetString(Resource.String.btnSendAsFile), null)
                    .SetNegativeButton(Resources.GetString(Resource.String.btnSendAsText), null)
                    .Create();
                case DIALOG_VIEW_TAGS:
                    dialogInput = new EditText(this);
                    return new AlertDialog.Builder(activity)
                    .SetMessage(GetString(Resource.String.edit_tags))
                    .SetTitle(string.Format(GetString(Resource.String.note_x_tags),dialogNote.getTitle()))
                    .SetView(dialogInput)
            //			    	.setNegativeButton(Resource.String.btnCancel, new DialogInterface.OnClickListener() {
            //						public void onClick(DialogInterface dialog, int whichButton) {
            //							removeDialog(DIALOG_VIEW_TAGS);
            //						}
            //			    	})
                    .setPositiveButton(Resource.String.btnOk, null)
                    .create();
                default:
                    alertDialog = null;
                }
            return alertDialog;
        }