public void SetDialogCloseWays(DialogConfig config, Android.App.Dialog dialog)
 {
     if (!config.IsCanCancel)
     {
         dialog.SetCancelable(false);
         return;
     }
     if (!config.IsCloseByTouchMask)
     {
         dialog.SetCancelable(true);
         dialog.SetCanceledOnTouchOutside(false);
     }
 }
Esempio n. 2
0
		public void showNoticeDialog(string title, string content){
			var noticeASAPTimeView = LayoutInflater.Inflate (Resource.Layout.popup_notice_layout, null);
			var tvTitle = noticeASAPTimeView.FindViewById<TextView> (Resource.Id.tv_title_notice_popup);
			var tvNotice = noticeASAPTimeView.FindViewById<TextView> (Resource.Id.tv_info_popup_notice);
			var btnOk = noticeASAPTimeView.FindViewById<Button> (Resource.Id.btn_ok_popup_notice);

			tvTitle.Text = title;
			tvNotice.Text = content;
			btnOk.Click += (sender, e) => {
				dialog.Dismiss ();
				if(noticeBeta != null){
					noticeBeta.onOK();
				}
			};

			builder = new AlertDialog.Builder (_activity);
			builder.SetView (noticeASAPTimeView);
			dialog = builder.Create ();
			dialog.SetCanceledOnTouchOutside (false);
			dialog.SetCancelable (false);
			try {
				dialog.Show ();
			} catch(Exception e){
				Console.WriteLine (e.Message);
			}
		}
 public SimpleDialog(Activity a,string tip)
 {
     _progressDialog = new Dialog(a, Resource.Style.progress_dialog);
     _progressDialog.SetContentView(Resource.Layout.SimpleDialog);
     _progressDialog.SetCancelable(true);
     _progressDialog.Window.SetBackgroundDrawableResource(Android.Resource.Color.Transparent);
     TextView msg = (TextView)_progressDialog.FindViewById(Resource.Id.id_tv_loadingmsg);
     msg.Text = tip;
 }
        //        protected override void OnCreate(Bundle bundle){
        //            base.OnCreate (bundle);
        //            SetContentView (Resource.Layout.AlertDialog);
        //
        //            Button bt = FindViewById<Button> (Resource.Id.button1);
        //
        //            bt.Click += delegate {
        //                CreateAddProjectDialog ();
        //            };
        //
        //            }
        /*
         *Klasa koja otvara prikaz povijesti placenih parkiranja.
         * */
        public static void CreateListDialog(Context context,List<string> lista)
        {
            Dialog dialog = new Dialog (context);
            dialog.SetContentView (Resource.Layout.DialogList);
            ListView lv = (ListView)dialog.FindViewById (Resource.Id.dialogList);
            //List<string> lista = new List<string> ();
            lv.Adapter = new ArrayAdapter<String> (context, Android.Resource.Layout.TestListItem, lista);
            dialog.Window.SetBackgroundDrawableResource (Android.Resource.Color.BackgroundDark);
            //dialog.Window.SetLayout(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
            //dialog.Window.RequestFeature(WindowFeatures.NoTitle);

            dialog.SetCancelable(true);
            dialog.SetTitle ("Povijest poruka.");
            dialog.Show();
        }
Esempio n. 5
0
        void ShowProxySettings ()
        {
            dialog = new Dialog (this);
            dialog.SetContentView (Resource.Layout.Proxy);
            dialog.SetTitle ("Proxy Settings"); 
            dialog.SetCancelable (true);

            dialog.CancelEvent += DialogDismissHandler;

            Button btnProxySave = (Button)dialog.FindViewById (Resource.Id.btnProxySave);
            Button btnProxyCancel = (Button)dialog.FindViewById (Resource.Id.btnProxyCancel);

            btnProxySave.Click += EnableProxy; 
            btnProxyCancel.Click += DisableProxy;
            
            proxyUsername = (EditText)dialog.FindViewById (Resource.Id.proxyUsername);
            proxyPassword = (EditText)dialog.FindViewById (Resource.Id.proxyPassword);
            proxyServer = (EditText)dialog.FindViewById (Resource.Id.proxyServer);
            proxyPort = (EditText)dialog.FindViewById (Resource.Id.proxyPort);
            
            tgProxy = (ToggleButton)dialog.FindViewById (Resource.Id.tbProxy);
            tgProxy.CheckedChange += ProxyCheckedChanged;
            tgProxy.Checked = true;

            if (proxy != null) {
                tgProxy.Checked = true;
                tvProxy.Text = SetProxyText(true);
            } else {
                tgProxy.Checked = false;

                tvProxy.Text = SetProxyText(false);
            }

            if ((proxy != null) && (!string.IsNullOrEmpty (proxy.ProxyServer))) {
                proxyServer.Text = proxy.ProxyServer;
            }
            if ((proxy != null) && (!string.IsNullOrEmpty (proxy.ProxyPort.ToString()))) {
                proxyPort.Text = proxy.ProxyPort.ToString();
            }
            if ((proxy != null) && (!string.IsNullOrEmpty (proxy.ProxyUserName))) {
                proxyUsername.Text = proxy.ProxyUserName;
            }
            if ((proxy != null) && (!string.IsNullOrEmpty (proxy.ProxyPassword))) {
                proxyPassword.Text = proxy.ProxyPassword;
            }

            dialog.Show();
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var  item = lista[position];
            View view = convertView;

            view = context.LayoutInflater.Inflate(Resource.Layout.layoutFechas, null);
            view.FindViewById <TextView>(Resource.Id.txtFexcha).Text = item.fecha;
            view.Click += delegate {
                Android.App.Dialog alertar = new Android.App.Dialog(context, Resource.Style.ThemeOverlay_AppCompat_Dialog);
                alertar.RequestWindowFeature(1);
                alertar.SetCancelable(true);
                alertar.SetContentView(Resource.Layout.layoutResumen);
                string concatenar = "";
                if (identificador == "0")
                {
                    var           con       = new SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "baseInterna.sqlite"));
                    var           consulta  = con.Query <Trabajadores>("select * from trabajadores", (new Trabajadores()).id_pregunta);
                    List <string> preguntas = new List <string>();
                    foreach (var itemP in consulta)
                    {
                        preguntas.Add(itemP.pregunta);
                    }
                    concatenar = preguntas[0] + "\r\n" + item.pregunta1 + "\r\n" + "\r\n"
                                 + preguntas[1] + "\r\n" + item.pregunta2 + "\r\n" + "\r\n"
                                 + preguntas[2] + "\r\n" + item.pregunta3 + "\r\n" + "\r\n"
                                 + preguntas[3] + "\r\n" + item.pregunta4 + "\r\n" + "\r\n"
                                 + preguntas[4] + "\r\n" + item.pregunta5 + "\r\n";
                }
                else
                {
                    var           con       = new SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "baseInterna.sqlite"));
                    var           consulta  = con.Query <Areas>("select * from Areas", (new Areas()).id_pregunta);
                    List <string> preguntas = new List <string>();
                    foreach (var itemP in consulta)
                    {
                        preguntas.Add(itemP.pregunta);
                    }
                    concatenar = preguntas[0] + "\r\n" + item.pregunta1 + "\r\n" + "\r\n"
                                 + preguntas[1] + "\r\n" + item.pregunta2 + "\r\n" + "\r\n"
                                 + preguntas[2] + "\r\n" + item.pregunta3 + "\r\n" + "\r\n"
                                 + preguntas[3] + "\r\n" + item.pregunta4 + "\r\n" + "\r\n"
                                 + preguntas[4] + "\r\n" + item.pregunta5 + "\r\n";
                }
                alertar.FindViewById <TextView>(Resource.Id.txtPreguntaR).Text = concatenar;
                alertar.Show();
            };
            return(view);
        }
Esempio n. 7
0
        public void InitializeDialog()
        {
            this.dialogView = new DialogView(this);
            var renderer = dialogView.GetOrCreateRenderer();

            nativeView = renderer.View;

            dialog = new Android.App.Dialog(BaseApplication.MainActivity);
            dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
            dialog.SetCancelable(false);
            dialog.SetContentView(nativeView);
            Window window = dialog.Window;

            window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            // window.ClearFlags(WindowManagerFlags.DimBehind);
            window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent));
        }
		public void ShowProgressDialog (string message)
		{
			if (_dialog != null) {
				HideProgressDialog ();
			}

			_dialog = new Dialog(Forms.Context);
			_dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
			_dialog.SetCancelable(false);
			_dialog.SetCanceledOnTouchOutside(false);

			Window window = _dialog.Window;
			window.SetLayout(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent);
			window.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Transparent));

			_dialog.SetContentView (Resource.Layout.dialog);

			var textView = (TextView)_dialog.FindViewById(Resource.Id._textView);
			textView.SetTypeface (_typeFaceRegular, TypefaceStyle.Normal);
			textView.Text = message;

			_dialog.Show();
		}
Esempio n. 9
0
        /// <summary>
        /// overrided bool to show a dialog window 
        /// when trying to exit the controller
        /// </summary>
        /// <param name="keyCode"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            //if the back key is pressed
            if (keyCode == Keycode.Back)
            {
                updateThread.Abort();
                //set the content view to the dialogwindow content
                //outside this contentview we are unable to find our resources
                SetContentView(Resource.Layout.DialogWindow);

                //create a new dialog
                dialog = new Dialog(this);
                dialog.SetContentView(Resource.Layout.DialogWindow);
                dialog.SetTitle("OML");
                dialog.SetCancelable(true);

                //set the dialog text
                dialogTxt = FindViewById<TextView>(Resource.Id.dialogText);
                dialogTxt.Text = "By leaving the controller interface you will exit the current session. \n\n Do you wish to continue?";

                //set the buttons
                okButton = FindViewById<Button>(Resource.Id.okButton);
                cancelButton = FindViewById<Button>(Resource.Id.cancelButton);

                //handle click events
                okButton.Click += delegate
                {
                    //change the background and finish the current activity (controller)
                    okButton.SetBackgroundResource(Resource.Drawable.okbutton_pressed);
                    //Close the Activity
                    Finish();
                    //Ends the Current Session!
                    Settings_Singleton.Instance.CloseCurrentSession();
                    //Close the Viewer TCP
                    Settings_Singleton.Instance.CloseViewerTCP();

                };//end delegate
                cancelButton.Click += delegate
                {
                    //change the background, cancel the dialog and set the contentview back to the controller
                    //so we can continue with our activity
                    cancelButton.SetBackgroundResource(Resource.Drawable.cancelbutton_pressed);
                    dialog.Cancel();
                    this.OnCreate(bundle);
                };//end delegate

                return true;
            }//end if
             	        return base.OnKeyDown(keyCode, e);
        }
Esempio n. 10
0
		void SetupDialog(Context context, MaskType maskType, Action cancelCallback, Func<Context, Dialog, MaskType, View> customSetup)
		{
			Application.SynchronizationContext.Send(state => {

				CurrentDialog = new Dialog(context);

				CurrentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle);

				if (maskType != MaskType.Black)
					CurrentDialog.Window.ClearFlags(WindowManagerFlags.DimBehind);

				if (maskType == MaskType.None)
					CurrentDialog.Window.SetFlags(WindowManagerFlags.NotTouchModal, WindowManagerFlags.NotTouchModal);

				CurrentDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));

				var customView = customSetup(context, CurrentDialog, maskType);

				CurrentDialog.SetContentView (customView);

				CurrentDialog.SetCancelable (cancelCallback != null);	
				if (cancelCallback != null)
					CurrentDialog.CancelEvent += (sender, e) => cancelCallback();

				CurrentDialog.Show ();

			}, null);
		}
Esempio n. 11
0
File: Live.cs Progetto: OML/OML_App
        private void DisplayDialogOkey()
        {
            //Close Keyboard
            InputMethodManager inputMgr = GetSystemService(InputMethodService) as InputMethodManager;
            if (CurrentFocus != null)
                inputMgr.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);

            //Open Connect Dialog!
            //set the content view to the dialogwindow content
            //outside this contentview we are unable to find our resources
            SetContentView(Resource.Layout.DialogWindow);

            //create a new dialog
            dialog = new Dialog(this);
            dialog.SetContentView(Resource.Layout.DialogWindow);
            dialog.SetTitle("OML");
            dialog.SetCancelable(true);

            //set the dialog text
            dialogTxt = FindViewById<TextView>(Resource.Id.dialogText);

            //set the buttons
            okButton = FindViewById<Button>(Resource.Id.okButton);
            cancelButton = FindViewById<Button>(Resource.Id.cancelButton);

            //Hide Cancel buttom, Only Okey needed
            cancelButton.Visibility = ViewStates.Invisible;

            okButton.Click += delegate
            {
                //change the background, close the dialog and set the contentview back to the live / connection screen
                //so we can continue with our activity
                //Draw Click
                okButton.SetBackgroundResource(Resource.Drawable.okbutton_pressed);
                //Close Dialog
                dialog.Cancel();
                this.OnCreate(bundle);
            };//end delegate
        }
Esempio n. 12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.dialog);

            // Normal Dialog
            Button mbtnAlert = FindViewById<Button> (Resource.Id.btnDialog);
            mbtnAlert.Click += delegate
            {
                new AlertDialog.Builder(this)
                    .SetTitle("Alert!")
                        .SetMessage("This is the content of the alert")
                        .SetPositiveButton("Ok", delegate
                                           {
                            Toast.MakeText(this, "Clicked ok", ToastLength.Short).Show();
                        })
                        .SetNegativeButton("Cancel", delegate
                                           {
                            Toast
                                .MakeText(this, "Clicked cancel", ToastLength.Short)
                                    .Show();
                        })
                        .Show();
            };

            //Progress Dialog
            Button mbtnProgress = FindViewById<Button>(Resource.Id.btnProgress);
            mbtnProgress.Click += delegate
            {
                ProgressDialog progressDialog = ProgressDialog.Show(this, "Running", "Please wait...", true);

                new Thread(new ThreadStart(delegate
                                           {
                    Thread.Sleep(5000);

                    RunOnUiThread(() => progressDialog.Hide());
                })).Start();
            };

            //Custom Dialog
            Button mbtnCustom = FindViewById<Button> (Resource.Id.btnCustom);
            mbtnCustom.Click += delegate
            {
                Dialog dialog = new Dialog(this);
                dialog.SetContentView(Resource.Layout.custom_dialog);
                dialog.SetTitle("This is a custom dialog");
                dialog.SetCancelable(true);
                EditText input = (EditText) dialog.FindViewById (Resource.Id.editTextD);
                TextView txtv = (TextView)dialog.FindViewById(Resource.Id.textView1);
                Button btnOk = (Button)dialog.FindViewById(Resource.Id.btnOk);
                btnOk.Click += delegate
                {
                    if (input.Text.Length>0){
                        Toast.MakeText(this, input.Text, ToastLength.Short).Show();
                    } else {
                        Toast.MakeText(this, "Clicked ok", ToastLength.Short).Show();
                    }

                    dialog.Cancel();
                };
                Button btnCancel = (Button)dialog.FindViewById(Resource.Id.btnCancel);
                btnCancel.Click += delegate
                {
                    dialog.Cancel();
                };

                dialog.Show();
            };

            Button mbackBtn = FindViewById<Button> (Resource.Id.BackBtn5);
            mbackBtn.Click += delegate
            {
                Finish();
            };
        }
Esempio n. 13
0
        protected override Dialog OnCreateDialog(int id)
        {
            //return base.OnCreateDialog (id);
            switch (id) {
            case DLG_WORK_TIME_WARNING:
                Dialog dialog = new Dialog (this);
                dialog.SetTitle ("Предупреждение");
                dialog.SetContentView (Resource.Layout.Dialog);
                dialog.FindViewById <Button> (Resource.Id.btnDlgClose).Click += (object sender, EventArgs e) => {
                    this.Finish();
                };

                dialog.SetCancelable (false);
                return dialog;
            }
            return null;
        }
Esempio n. 14
0
        void MultiChoice(object sender, EventArgs e)
        {
            var dialog = new Dialog (this);
            dialog.RequestWindowFeature(1);
            dialog.SetContentView (Resource.Layout.multichoice);
            dialog.Window.SetBackgroundDrawableResource (Resource.Drawable.station_sign_background);
            dialog.Window.SetFeatureInt (WindowFeatures.NoTitle,0);
            dialog.SetCancelable (true);

            var title = (TextView) dialog.FindViewById (Resource.Id.titleDialog);
            title.Typeface = kalingab;

            var listView = (ListView) dialog.FindViewById (Resource.Id.multiListView);
            listView.Clickable = true;
            listView.ChoiceMode = ChoiceMode.Multiple;
            listView.ItemClick += (object s, AdapterView.ItemClickEventArgs ev) => {
                var conn = connections [ev.Position];
                conn.Save = !conn.Save;
                Console.WriteLine ("item clicked {0}", ev.Position);
                ((XListViewAdapter) listView.Adapter).NotifyDataSetChanged ();
            };

            var listAdapter = new XListViewAdapter (this, connections);
            listView.Adapter = listAdapter;
            //XListViewAdapter.CheckHandler += RadioClicked;
            var btnOk = (Button)dialog.FindViewById(Resource.Id.bOk);
            btnOk.Click += delegate {
                foreach (var connection in connections) {
                    if (connection.Save) {
                        Console.WriteLine ("id: {0} Save?:{1}", connection.ID, connection.Save);
                    }
                }
                //cCommand.AddConnection (connection);
                var cCommand = new ConnectionCommands (this);
                cCommand.Close ();
                dialog.Cancel ();
            };

            var btnCancel = (Button)dialog.FindViewById(Resource.Id.bCancel);
            btnCancel.Click += delegate {
                dialog.Cancel ();
            };

            dialog.Show();
        }
Esempio n. 15
0
        /// <summary>
        /// Opens a dialog window with the choice to release the object we picked up (ring)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void releaseClick(object sender, EventArgs e)
        {
            //reset the button drawable
            btnDrawableReset();
            //set the background
            release.SetBackgroundResource(Resource.Drawable.releasebutton_pressed);

            updateThread.Abort();

            //set the content view to the dialogwindow content
            //outside this contentview we are unable to find our resources
            SetContentView(Resource.Layout.DialogWindow);

            //create a new dialog
            dialog = new Dialog(this);
            dialog.SetContentView(Resource.Layout.DialogWindow);
            dialog.SetTitle("Release ring");
            dialog.SetCancelable(true);

            //set the dialog text
            dialogTxt = FindViewById<TextView>(Resource.Id.dialogText);
            dialogTxt.Text = "Are you sure you want to release the ring?";

            //set the buttons
            okButton = FindViewById<Button>(Resource.Id.okButton);
            cancelButton = FindViewById<Button>(Resource.Id.cancelButton);

            //handle click events
            okButton.Click += delegate
            {
                //change the background and finish the current activity (controller)
                okButton.SetBackgroundResource(Resource.Drawable.okbutton_pressed);

                //set bool true to get carmen to release the ring
                Send_Singleton.Instance.releaseRing = 1;

                SetContentView(Resource.Layout.Controller);
                this.OnCreate(bundle);
                //Close the dialog
                dialog.Cancel();
            };//end delegate
            cancelButton.Click += delegate
            {
                //change the background, cancel the dialog and set the contentview back to the controller
                //so we can continue with our activity
                cancelButton.SetBackgroundResource(Resource.Drawable.cancelbutton_pressed);
                dialog.Cancel();
                this.OnCreate(bundle);
            };//end delegate
        }
Esempio n. 16
0
        void SetupDialog(Context context, MaskType maskType, Func<Context, Dialog, MaskType, View> customSetup)
        {
            Application.SynchronizationContext.Post(state => {

                CurrentDialog = new Dialog(context);

                CurrentDialog.RequestWindowFeature((int)WindowFeatures.NoTitle);

                if (maskType != MaskType.Black)
                    CurrentDialog.Window.ClearFlags(WindowManagerFlags.DimBehind);

                CurrentDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));

                var customView = customSetup(context, CurrentDialog, maskType);

                CurrentDialog.SetContentView (customView);
                CurrentDialog.SetCancelable (false);

                CurrentDialog.Show ();

            }, null);
        }
Esempio n. 17
0
		private void showNoticeActivation(string title, string content, bool isSuccess){
			var noticeActivationView = LayoutInflater.Inflate (Resource.Layout.popup_notice_layout, null);
			var tvTitle = noticeActivationView.FindViewById<TextView> (Resource.Id.tv_title_notice_popup);
			var tvNotice = noticeActivationView.FindViewById<TextView> (Resource.Id.tv_info_popup_notice);
			var btnOk = noticeActivationView.FindViewById<Button> (Resource.Id.btn_ok_popup_notice);

			btnOk.Click += (sender, e) => {
				dialog.Dismiss ();
				if(isSuccess)
					Finish();
			};

			tvTitle.Text = title;
			tvNotice.Text = content;

			builder = new AlertDialog.Builder (this);
			builder.SetView (noticeActivationView);
			dialog = builder.Create ();
			dialog.SetCanceledOnTouchOutside (false);
			dialog.SetCancelable (false);
			dialog.Show ();

		}
Esempio n. 18
0
        void DatePicker_Dialog(object sender, EventArgs e)
        {
            dialog = new Dialog (this);
            dialog.RequestWindowFeature(1);
            dialog.SetContentView (Resource.Layout.datedialog);
            dialog.Window.SetBackgroundDrawableResource (Resource.Drawable.empty);
            dialog.Window.SetFeatureInt (WindowFeatures.NoTitle,0);
            dialog.Window.ClearFlags (WindowManagerFlags.DimBehind);
            dialog.SetCancelable (true);
            dialog.SetCanceledOnTouchOutside (true);

            // day
            var dayInput = dialog.FindViewById (Resource.Id.dayInput) as EditText;
            var dayUp = dialog.FindViewById (Resource.Id.dayUp) as Button;
            var dayDown = dialog.FindViewById (Resource.Id.dayDown) as Button;
            dayUp.Tag = Resource.Id.dayInput;
            dayDown.Tag = Resource.Id.dayInput;
            dayUp.Click += Change_Date;
            dayDown.Click += Change_Date;

            // day
            var monthInput = dialog.FindViewById (Resource.Id.monthInput) as EditText;
            var monthUp = dialog.FindViewById (Resource.Id.monthUp) as Button;
            var monthDown = dialog.FindViewById (Resource.Id.monthDown) as Button;
            monthUp.Tag = Resource.Id.monthInput;
            monthDown.Tag = Resource.Id.monthInput;
            monthUp.Click += Change_Date;
            monthDown.Click += Change_Date;

            // year
            var yearInput = dialog.FindViewById (Resource.Id.yearInput) as TextView;
            var yearUp = dialog.FindViewById (Resource.Id.yearUp) as Button;
            var yearDown = dialog.FindViewById (Resource.Id.yearDown) as Button;
            yearUp.Tag = Resource.Id.yearInput;
            yearDown.Tag = Resource.Id.yearInput;
            yearUp.Click += Change_Date;
            yearDown.Click += Change_Date;

            var date = dateLabel.Text.Split ('/');

            RunOnUiThread (() => {
                dayInput.Text = date [0];
                monthInput.Text = date [1];
                yearInput.Text = String.Format ("20{0}", date [2]);
            });

            var btnOk = (Button)dialog.FindViewById(Resource.Id.button2);
            btnOk.Click += delegate {
                RunOnUiThread (() => dateLabel.Text =
                               String.Format ("{0}/{1}/{2}", dayInput.Text, monthInput.Text, yearInput.Text.Substring (2)));
                dialog.Dismiss ();
            };

            var btnCancel = (Button)dialog.FindViewById(Resource.Id.button1);
            btnCancel.Click += delegate {
                dialog.Cancel ();
            };
            dialog.Show();
        }
Esempio n. 19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.Menu);
            iniView ();
            Button ajout = FindViewById<Button> (Resource.Id.ajouttournee);

            //TEST
            //editText = FindViewById<EditText>(Resource.Id.passwordfield);

            bodyListView = FindViewById<ListView> (Resource.Id.bodylist);
            bodyItems = new List<TablePosition> ();

            adapter = new ListViewAdapterMenu (this, bodyItems);
            bodyListView.Adapter = adapter;

            initListView ("SELECT * FROM TablePosition");

            ajout.Click += delegate {
                Dialog dialog = new Dialog (this);
                dialog.Window.RequestFeature (WindowFeatures.NoTitle);
                dialog.Window.SetBackgroundDrawableResource (Resource.Drawable.bktransbox);
                dialog.SetContentView (Resource.Layout.Boxajout);
                Button cree = dialog.FindViewById<Button> (Resource.Id.btn_cree);
                EditText codeeditText = dialog.FindViewById<EditText> (Resource.Id.codetournee);
                cree.Click += delegate {
                    ShowProgress (progress => AndHUD.Shared.Show (this, "Création... " + progress + "%", progress, MaskType.Clear));
                    Thread thread = new Thread (() => CreateVoyage (codeeditText.Text));
                    thread.Start ();
                    while (thread.IsAlive) {
                        iniView ();
                    }
                    dialog.Dismiss ();
                };
                cree.LongClick += delegate {
                    DBRepository dbr = new DBRepository ();
                    dbr.DropTableStatut ();
                    initListView("SELECT * FROM TablePosition");
                    iniView ();
                };
                dialog.SetCancelable (true);
                dialog.Show ();
            };

            //SIMULATION D'insert
            Button btntest = FindViewById<Button> (Resource.Id.nomtournee);
            btntest.Click += delegate {
                ShowProgressInsert (progress => AndHUD.Shared.Show (this, "Insertion ... " + progress + "%", progress, MaskType.Clear));
                Thread threadinsert = new Thread (() => GetPosData ("1406026994"));
                threadinsert.Start ();

                //GetPosData (stringbuilder.ToString());

            };
        }
Esempio n. 20
0
        void TimePicker_Dialog(object sender, EventArgs e)
        {
            dialog = new Dialog (this);
            dialog.RequestWindowFeature(1);
            dialog.SetContentView (Resource.Layout.timedialog);
            dialog.Window.SetBackgroundDrawableResource (Resource.Drawable.empty);
            dialog.Window.SetFeatureInt (WindowFeatures.NoTitle,0);
            dialog.Window.ClearFlags (WindowManagerFlags.DimBehind);
            dialog.SetCancelable (true);
            dialog.SetCanceledOnTouchOutside (true);

            // hour
            var hourInput = dialog.FindViewById (Resource.Id.hourInput) as EditText;
            var hourUp = dialog.FindViewById (Resource.Id.hourUp) as Button;
            var hourDown = dialog.FindViewById (Resource.Id.hourDown) as Button;
            hourUp.Tag = Resource.Id.hourInput;
            hourDown.Tag = Resource.Id.hourInput;
            hourUp.Click += Change_Time;
            hourDown.Click += Change_Time;

            // minute
            var minuteInput = dialog.FindViewById (Resource.Id.minuteInput) as EditText;
            var minuteUp = dialog.FindViewById (Resource.Id.minuteUp) as Button;
            var minuteDown = dialog.FindViewById (Resource.Id.minuteDown) as Button;
            minuteUp.Tag = Resource.Id.minuteInput;
            minuteDown.Tag = Resource.Id.minuteInput;
            minuteUp.Click += Change_Time;
            minuteDown.Click += Change_Time;

            var time = timeLabel.Text.Split(':');

            RunOnUiThread (() => {
                hourInput.Text = time [0];
                minuteInput.Text = time [1];
            });

            var btnOk = (Button)dialog.FindViewById(Resource.Id.button2);
            btnOk.Click += delegate {
                RunOnUiThread (() => timeLabel.Text =
                               String.Format ("{0}:{1}", hourInput.Text, minuteInput.Text));
                dialog.Dismiss ();
            };

            var btnCancel = (Button)dialog.FindViewById(Resource.Id.button1);
            btnCancel.Click += delegate {
                dialog.Cancel ();
            };
            dialog.Show();;
        }
Esempio n. 21
0
        public void TwitterPermissions()
        {
            if (!twitterBox.Checked)
                return;

            ISharedPreferences prefs = GetSharedPreferences(Global.PREFS_NAME, 0);
            string AccountName = prefs.GetString ("TwitterName", "");

            Dialog dialog = new Dialog(this);
            dialog.SetContentView(Resource.Layout.TwitterPopup);
            EditText twitterNameBox = (EditText)dialog.FindViewById(Resource.Id.twitterNameBox);
            twitterNameBox.Text = AccountName;
            dialog.SetTitle("Twitter");
            dialog.SetCancelable(false);

            dialog.FindViewById(Resource.Id.twitterCancel).Click += delegate {
                twitterBox.Checked = false;
                dialog.Dismiss();
            };
            dialog.FindViewById(Resource.Id.twitterConfirm).Click += delegate {
                AccountName = twitterNameBox.Text;
                ISharedPreferencesEditor editor = prefs.Edit ();
                editor.PutString("TwitterName", AccountName);
                editor.Commit();
                dialog.Dismiss();
                Log.Debug ( TAG, AccountName );
            };
            dialog.Show();
        }