protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView(Resource.Layout.SettingsScreen);

            themeSpinner = FindViewById<Spinner> (Resource.Id.ThemeSpinner);
            fontSizeSpinner = FindViewById<Spinner> (Resource.Id.FontSizeSpinner);

            selectedTheme = Convert.ToInt32 (prefs.GetString (ThemeKey, "0"));
            selectedFontSize = Convert.ToInt32 (prefs.GetString (FontSizeKey, "0"));

            themeSpinner.ItemSelected += ThemeSpinner_ItemSelected;
            var adapter = ArrayAdapter.CreateFromResource (
                this, Resource.Array.themes, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            themeSpinner.Adapter = adapter;

            fontSizeSpinner.ItemSelected += FontSizeSpinner_ItemSelected;
            adapter = ArrayAdapter.CreateFromResource (
                this, Resource.Array.font_sizes, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            fontSizeSpinner.Adapter = adapter;

            themeSpinner.SetSelection (selectedTheme);
            fontSizeSpinner.SetSelection (selectedFontSize);
        }
Example #2
0
    protected async override void OnCreate(Bundle bundle)
    {
      base.OnCreate(bundle);

      SetContentView(Resource.Layout.view_expense);

      dialog = ServiceContainer.Resolve<IMessageDialog>();

      var id = Intent.GetIntExtra("ID", -1);
      viewModel = ServiceContainer.Resolve<ExpenseViewModel>();
      await viewModel.Init(id);

      this.ActionBar.Title = viewModel.Title;
      viewModel.IsBusyChanged = (busy) =>
      {
        if (busy)
          AndHUD.Shared.Show(this, "Loading...");
        else
          AndHUD.Shared.Dismiss(this);
      };

      name = FindViewById<EditText>(Resource.Id.name);
      date = FindViewById<DatePicker>(Resource.Id.date);
      notes = FindViewById<EditText>(Resource.Id.notes);
      total = FindViewById<EditText>(Resource.Id.total);
      billable = FindViewById<CheckBox>(Resource.Id.billable);
      category = FindViewById<Spinner>(Resource.Id.category);
      category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories);
      category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category));
      name.Text = viewModel.Name;
      date.DateTime = viewModel.Due;
      notes.Text = viewModel.Notes;
      total.Text = viewModel.Total;
      billable.Checked = viewModel.Billable;
    }
Example #3
0
        public Screen7Summary(Activity context, PointDto point)
            : base(context, Resource.Layout.Edit7Summary, point)
        {
            PointPart7Summary item = Point.PointDataDto.PointPart7Summary;

            invalidMoveAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_move_availability);
            invalidHearingAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_hearing_availability);
            invalidEyeAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_eye_availability);
            otherText = View.FindViewById<EditText>(Resource.Id.otherComments);
            reportDate = View.FindViewById<EditText>(Resource.Id.protocolDate);

            invalidMoveAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                  "ќбъект не доступен (если нет пандуса, не соответствует ширина проемов, высота порогов)");
            invalidHearingAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                     "ќбъект не доступен (если отсутствуют световые табло, индукционна¤ петл¤)");
            invalidEyeAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
                                                                 "ќбъект не доступен (если отсутствуют тактильные маршруты, звуковое оповещение, контрастна¤ маркировка дверей и стекл¤нных поверхностей)");

            reportDate.Text = item.ReportDate.ToLocalTime().Date.ToString(CultureInfo.CurrentCulture);

            invalidMoveAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidMoveAvailability));
            invalidHearingAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidHearingAvailability));
            invalidEyeAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidEyeAvailability));

            otherText.Text = item.OtherComments;
        }
Example #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.ShareLocation);

            customDate = DateTime.Now;

            boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress);
            boxProgress.Visibility = ViewStates.Gone;

            textDate = FindViewById<TextView> (Resource.Id.textDate);
            textDate.Visibility = ViewStates.Gone;

            spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime);
            spinnerTime.ItemSelected += HandleItemSelected;
            arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem);
            arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerTime.Adapter = arrayAdapter;
            spinnerTime.SetSelection (defaultTimeIndex);
            selectedTime = timeValues [defaultTimeIndex];

            shareButton = FindViewById<Button> (Resource.Id.buttonShare);
            shareButton.Click += HandleShareClick;

            textDate.Click += delegate {
                ShowDialog (0);
            };
        }
Example #5
0
		static System.Threading.Thread LoadThread; //Поток, отвечающий за загрузку расписания

		protected override void OnCreate (Bundle bundle)
		{
			context = this;
			groups = Resources.GetTextArray (Resource.Array.group_codes);

			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Main);
			//RequestWindowFeature (WindowFeatures.NoTitle);
			text = FindViewById<TextView> (Resource.Id.text);
			Button today = FindViewById<Button> (Resource.Id.today);
			Button tomorrow = FindViewById<Button> (Resource.Id.tomorrow);
			Button OnDate = FindViewById<Button> (Resource.Id.toDate);
			spinner = FindViewById<Spinner> (Resource.Id.spinner1);
			viewSwitcher = FindViewById<ViewSwitcher> (Resource.Id.viewSwitcher1);
			DateTime dateToday = DateTime.Today;
			DateTime dateTomorrow = DateTime.Today.AddDays (1);
			DatePicker datePicker = FindViewById<DatePicker> (Resource.Id.datePicker);
			ConnectivityManager cm = (ConnectivityManager)GetSystemService (Context.ConnectivityService);

			spinner.SetSelection (loadingGroup ());

		
			//Обработчики нажатий кнопок

			today.Click += delegate { //На сегодня
				savingGroup (spinner.SelectedItemPosition);
				if (cm.ActiveNetworkInfo != null) { //Если присутствует соединение с интернетом - запустить функцию, 
					StartLoadingThread (dateToday);// получающую расписание с сайта
				} else {
					text.Text = "Проверьте соединение с интернетом";//Иначе, выводит ошибку
					viewSwitcher.ShowNext ();
				}

			};
			tomorrow.Click += delegate { //На завтра
				savingGroup (spinner.SelectedItemPosition);
				if (cm.ActiveNetworkInfo != null) {
					StartLoadingThread (dateTomorrow);
				} else {
					text.Text = "Проверьте соединение с интернетом";
					viewSwitcher.ShowNext ();
				}

			};
			OnDate.Click += delegate {//На дату
				savingGroup (spinner.SelectedItemPosition);
				if (cm.ActiveNetworkInfo != null) {
					StartLoadingThread (datePicker.DateTime);
				} else {
					text.Text = "Проверьте соединение с интернетом";
					viewSwitcher.ShowNext ();
				}

			};
		}
 private void SelectCountry(PoiCountry?country)
 {
     if (country.HasValue)
     {
         var pos = _countryAdapter.GetPosition(country.Value);
         if (pos >= 0)
         {
             _downloadCountrySpinner?.SetSelection(pos);
             _downloadCountryListView?.SetSelection(pos);
             OnCountrySelected(pos);
         }
     }
 }
		public override Android.Views.View GetPropertyWindowLayout (Android.Content.Context context)
		{
			View view = new View (context);
			Spinner spin = new Spinner (context);
			List<String> adapter = new List<String> (){"Single","Single/Deselect","Multiple","None" };
			ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem,adapter);
			spin.Adapter = dataAdapter;
			TextView txt = new TextView (context);
			txt.Text = "Set Selection Mode";
			txt.TextSize = 15f;
			txt.SetPadding (10, 10, 10, 10);
			spin.SetPadding (10, 10, 10, 10);
			LinearLayout linear = new LinearLayout (context);
			linear.Orientation = Orientation.Horizontal;
			linear.AddView (txt);
			linear.AddView (spin);
            spin.SetSelection(2);
			spin.ItemSelected += OnSelectionModeChanged;
			return linear;
		}
Example #8
0
		public override View GetPropertyWindowLayout (Android.Content.Context context)
		{
			LinearLayout linear = new LinearLayout (context);
			linear.Orientation = Orientation.Horizontal;
			TextView txt = new TextView (context);
			txt.Text = "Select Theme";
			txt.SetPadding (10, 10, 10, 10);
			txt.TextSize = 15f;
			Spinner themeDropDown = new Spinner (context);
			List<String> adapter = new List<String> (){"Default","Dark","Blue","Red","Green" };
			ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
				(context, Android.Resource.Layout.SimpleSpinnerItem,adapter);
			themeDropDown.Adapter = dataAdapter; 
			themeDropDown.SetPadding (10, 10, 10, 10);
            themeDropDown.SetSelection(1);
			themeDropDown.ItemSelected += OnGridThemeChanged;
			themeDropDown.SetMinimumHeight (70);
			linear.AddView (txt);
			linear.AddView (themeDropDown);
			return linear;
		}
Example #9
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string dbPath_attributes = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "attributes.db3");
            var    db_attributes     = new SQLiteConnection(dbPath_attributes);

            myAttributes = db_attributes.Get <MyAttributes>(1);

            string type = myAttributes.type;

            if (type == "Student")
            {
                View view = inflater.Inflate(Resource.Layout.StudentEditProfileTab, container, false);
                updateName  = view.FindViewById <EditText>(Resource.Id.updateName);
                updateEmail = view.FindViewById <EditText>(Resource.Id.updateEmail);

                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);
                school      = view.FindViewById <Spinner>(Resource.Id.updateSchool);
                major       = view.FindViewById <Spinner>(Resource.Id.updateMajor);
                gpa         = view.FindViewById <Spinner>(Resource.Id.updateGPA);
                gradterm    = view.FindViewById <Spinner>(Resource.Id.updateGradTerm);
                Button confirmChanges = view.FindViewById <Button>(Resource.Id.saveChangesEditProfile);
                Button cancel         = view.FindViewById <Button>(Resource.Id.cancelEditProfile);

                updateName.Text  = myAttributes.name;
                updateEmail.Text = myAttributes.email;

                confirmChanges.Click += ConfirmChanges_Click;
                cancel.Click         += Cancel_Click;

                school.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(school_ItemSelected);
                var schooladapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.school_array, Android.Resource.Layout.SimpleSpinnerItem);
                schooladapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                school.Adapter = schooladapter;
                string defaultSchool = myAttributes.attribute1;

                if (!defaultSchool.Equals(null))
                {
                    int spinnerPosition = schooladapter.GetPosition(defaultSchool);
                    school.SetSelection(spinnerPosition);
                }

                major.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(major_ItemSelected);
                var majoradapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.major_array, Android.Resource.Layout.SimpleSpinnerItem);
                majoradapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                major.Adapter = majoradapter;
                string defaultMajor = myAttributes.attribute3;

                if (!defaultMajor.Equals(null))
                {
                    int spinnerPosition = majoradapter.GetPosition(defaultMajor);
                    major.SetSelection(spinnerPosition);
                }

                gpa.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(gpa_ItemSelected);
                var gpaadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.gpa_array, Android.Resource.Layout.SimpleSpinnerItem);
                gpaadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gpa.Adapter = gpaadapter;
                string defaultGPA = myAttributes.attribute4;

                if (!defaultGPA.Equals(null))
                {
                    int spinnerPosition = gpaadapter.GetPosition(defaultGPA);
                    gpa.SetSelection(spinnerPosition);
                }

                gradterm.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(gradterm_ItemSelected);
                var gradtermadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.year_array, Android.Resource.Layout.SimpleSpinnerItem);
                gradtermadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gradterm.Adapter = gradtermadapter;
                string defaultGradTerm = myAttributes.attribute2;

                if (!defaultGradTerm.Equals(null))
                {
                    int spinnerPosition = gradtermadapter.GetPosition(defaultGradTerm);
                    gradterm.SetSelection(spinnerPosition);
                }

                return(view);
            }

            else if (type == "Recruiter")
            {
                View view = inflater.Inflate(Resource.Layout.RecruiterEditProfileTab, container, false);
                updateName  = view.FindViewById <EditText>(Resource.Id.updateName);
                updateEmail = view.FindViewById <EditText>(Resource.Id.updateEmail);
                company     = view.FindViewById <Spinner>(Resource.Id.updateMyCompany);
                rakField    = view.FindViewById <EditText>(Resource.Id.rak);
                progressBar = view.FindViewById <ProgressBar>(Resource.Id.circularProgress);

                Button confirmChanges = view.FindViewById <Button>(Resource.Id.saveChangesEditProfile);
                Button cancel         = view.FindViewById <Button>(Resource.Id.cancelEditProfile);

                updateName.Text  = myAttributes.name;
                updateEmail.Text = myAttributes.email;

                confirmChanges.Click += ConfirmChanges_Click;
                cancel.Click         += Cancel_Click;

                company.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(company_ItemSelected);
                var companyadapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.company_array, Android.Resource.Layout.SimpleSpinnerItem);
                companyadapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                company.Adapter = companyadapter;
                string defaultCompany = myAttributes.attribute1;

                if (!defaultCompany.Equals(null))
                {
                    int spinnerPosition = companyadapter.GetPosition(defaultCompany);
                    company.SetSelection(spinnerPosition);
                }

                return(view);
            }

            else
            {
                throw new NotImplementedException();
            }
        }
        public async void RouteScanData(string barcode, string symbology)
        {
            if (!(View is ViewGroup root))
            {
                return;
            }
            CloseKeyboard();
            TextView     results    = root.FindViewById <TextView>(Resource.Id.resultData);
            const string typePrefix = "label-type-";
            const string gs1Prefix  = "gs1-";

            if (symbology.StartsWith(typePrefix))
            {
                symbology = symbology.Substring(typePrefix.Length);
            }
            if (symbology.StartsWith(gs1Prefix) && !Enum.TryParse(symbology.Replace('-', '_'), out Symbology _))
            {
                symbology = symbology.Substring(gs1Prefix.Length);
            }
            string upcA = null;

            if (symbology.StartsWith("upce"))
            {
                symbology = "upce";
                // Calculate UPC-A code for product lookup
                upcA = EAN8ToUPCA(barcode);
            }
            if (symbology == "databar")
            {
                symbology += barcode.Length > 16 || !long.TryParse(barcode, out _) ? "expanded" : "stackedomni";
            }
            TextView resultLabel;

            switch (_item.Id)
            {
            case "1":
                EditText barcodeText = root.FindViewById <EditText>(Resource.Id.barcodeText);
                barcodeText.Text = barcode;

                Spinner barcodeType = root.FindViewById <Spinner>(Resource.Id.barcodeTypes);
                int     index       = Array.IndexOf(Enum.GetValues(typeof(Symbology)), Enum.Parse <Symbology>(symbology.Replace('-', '_')));
                if (index > -1)
                {
                    barcodeType.SetSelection(index + 1);
                }
                return;

            case "2":
                _details               = "";
                results.Text           = _details;
                resultLabel            = root.FindViewById <TextView>(Resource.Id.resultLabel);
                resultLabel.Visibility = ViewStates.Gone;
                _showResultsLabel      = false;
                try
                {
                    // Call to external Zebra FDA Food Recall API
                    var foodUpcJson = await FDARecall.FoodUpcAsync(barcode);

                    OnPostExecute(JToken.Parse(foodUpcJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                try
                {
                    // Call to external Zebra FDA Drug Recall API
                    var drugUpcJson = await FDARecall.DrugUpcAsync(barcode);

                    OnPostExecute(JToken.Parse(drugUpcJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                return;

            case "3":
                _details               = "";
                results.Text           = _details;
                resultLabel            = root.FindViewById <TextView>(Resource.Id.resultLabel);
                resultLabel.Visibility = ViewStates.Gone;
                _showResultsLabel      = false;
                EditText upc = root.FindViewById <EditText>(Resource.Id.upc);
                upc.Text = upcA ?? barcode;
                try
                {
                    // Call to external Zebra UPC Lookup API
                    var upcLookupJson = await UPCLookup.LookupAsync(upcA ?? barcode);

                    OnPostExecute(JToken.Parse(upcLookupJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                return;
            }
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
			VBUser user = VBUser.GetUserFromPreferences();

			View view = inflater.Inflate(Resource.Layout.TeamDetailsProfileFragment, container, false);

			#region buttons
			Button btnRequestRank = view.FindViewById<Button>(Resource.Id.teamDetailsBtnRequestRank);
			Button btnSave = view.FindViewById<Button>(Resource.Id.teamDetailsBtnSave);

			btnRequestRank.SetOnClickListener(new TeamDetailsClickListener(TeamDetailsClickListener.ON_REQUEST_RANK, this));
			btnSave.SetOnClickListener(new TeamDetailsClickListener(TeamDetailsClickListener.ON_SAVE, this));
			#endregion

			#region requests
			LinearLayout requestListView = view.FindViewById<LinearLayout>(Resource.Id.teamDetailsRequestList);

			if(this.listRequests != null) {
				//see all requests if you're admin of the team
				if(this.listRequests.Count > 0 && DB_Communicator.getInstance().isAtLeast(teamrole.getUserType(), UserType.Admin)) {
					view.FindViewById<LinearLayout>(Resource.Id.teamDetailsRequestsLayout).Visibility = ViewStates.Visible;
					this.initialzeListRequests(requestListView, this.listRequests, inflater);
					
				//see your own reqeust if there is any
				} else if(this.getOwnRequests(listRequests).Count > 0) {
					view.FindViewById<LinearLayout>(Resource.Id.teamDetailsRequestsLayout).Visibility = ViewStates.Visible;
					this.initialzeListRequests(requestListView, this.getOwnRequests(listRequests), inflater);

				//see nothing
				} else if(this.listRequests.Count == 0) {
					view.FindViewById<LinearLayout>(Resource.Id.teamDetailsRequestsLayout).Visibility = ViewStates.Gone;
				}
			} else {
				//see nothing
				view.FindViewById<LinearLayout>(Resource.Id.teamDetailsRequestsLayout).Visibility = ViewStates.Gone;
			}
			#endregion

			#region teamrole
			view.FindViewById<LinearLayout>(Resource.Id.teamDetailsUserTypeLine).Visibility = ViewStates.Gone;
			view.FindViewById<LinearLayout>(Resource.Id.teamDetailsPositionLine).Visibility = ViewStates.Gone;
			view.FindViewById<LinearLayout>(Resource.Id.teamDetailsNumberLine).Visibility = ViewStates.Gone;

			if(teamrole != null ) {
				view.FindViewById<LinearLayout>(Resource.Id.teamDetailsProfileLayout).Visibility = ViewStates.Visible;
				btnSave.Visibility = ViewStates.Visible;

				//userTyp
				view.FindViewById<LinearLayout>(Resource.Id.teamDetailsUserTypeLine).Visibility = ViewStates.Visible;
				view.FindViewById<TextView>(Resource.Id.teamDetailsUserTypeValue).Text = teamrole.getUserType().ToString();

				if(DB_Communicator.getInstance().isAtLeast(teamrole.getUserType(), UserType.Member)) {
					btnRequestRank.Visibility = ViewStates.Visible;
				} else {
					btnRequestRank.Visibility = ViewStates.Gone;
				}

				if(DB_Communicator.getInstance().isAtLeast(teamrole.getUserType(), UserType.Coremember)) {
					//Position
					view.FindViewById<LinearLayout>(Resource.Id.teamDetailsPositionLine).Visibility = ViewStates.Visible;
					position = view.FindViewById<Spinner>(Resource.Id.teamDetailsPositionValue);

					ArrayAdapter adapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.positions, Resource.Layout.SpinnerTextView);
					adapter.SetDropDownViewResource(Resource.Layout.SpinnerCheckedLayout);
					position.Adapter = adapter;

					position.SetSelection(getIdOfPosition(teamrole.position));

					//Number
					view.FindViewById<LinearLayout>(Resource.Id.teamDetailsNumberLine).Visibility = ViewStates.Visible;
					number = view.FindViewById<EditText>(Resource.Id.teamDetailsNumberValue);

					number.Text = teamrole.number.ToString();
					
				} else {
					btnSave.Visibility = ViewStates.Gone;
				}
			} else {
				view.FindViewById<LinearLayout>(Resource.Id.teamDetailsProfileLayout).Visibility = ViewStates.Gone;
				view.FindViewById<TextView>(Resource.Id.teamDetailsUserTypeValue).Visibility = ViewStates.Gone;
				btnSave.Visibility = ViewStates.Gone;
			}
			#endregion
			return view;
		}
Example #12
0
        void SetSelectedItem(string text)
        {
            int position = dataAdapter.GetPosition(text);

            spinner.SetSelection(position);
        }
Example #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Login);

            if (SysVisitor.getVersionCode(this) != -1)
            {
                _publicfuns.of_SetMySysSet("app", "vercode", SysVisitor.getVersionCode(this).ToString());
            }
            if (SysVisitor.getVersionName(this) != "")
            {
                _publicfuns.of_SetMySysSet("app", "vername", SysVisitor.getVersionName(this));
            }
            _publicfuns.of_SetMySysSet("phone", "meid", SysVisitor.MEID(this));
            #region 自动登录
            if (_publicfuns.of_GetMySysSet("Login", "Login") == "Y")
            {
                string ls_user = _publicfuns.of_GetMySysSet("Login", "username");
                string ls_pwd = _publicfuns.of_GetMySysSet("Login", "password");
                string ls_logindate = _publicfuns.of_GetMySysSet("Login", "logindate");
                if (!string.IsNullOrEmpty(ls_user) && !string.IsNullOrEmpty(ls_pwd))
                {
                    DateTime time;
                    try
                    {
                        time = Convert.ToDateTime(ls_logindate);
                    }
                    catch
                    {
                        time = DateTime.Now.AddDays(-100);
                    }
                    if (SysVisitor.DateDiff(time.ToString(), SysVisitor.timeSpan.Days) <= 7)
                    {
                        SysVisitor.UserName = ls_user;
                        Intent it = new Intent();
                        Bundle bu = new Bundle();
                        bu.PutString("name", "data");
                        bu.PutString("update", "");
                        it.PutExtras(bu);
                        it.SetClass(this.ApplicationContext, typeof(Index));
                        StartActivity(it);
                        Finish();
                        return;
                    }
                }
            }
            #endregion
            string ls_DeviceId = SysVisitor.MEID(this);

            #region 初始化控件
            spinner = FindViewById<Spinner>(Resource.Id.login_company);
            spinner_mygroup = FindViewById<Spinner>(Resource.Id.login_group);
            username = FindViewById<Spinner>(Resource.Id.login_username);
            btn_cancel = FindViewById<Button>(Resource.Id.login_cancel);
            btn_login = FindViewById<Button>(Resource.Id.login_submit);
            Refresh = FindViewById<TextView>(Resource.Id.login_Refresh);
            password = FindViewById<EditText>(Resource.Id.login_pass);
            chk_showpwd = FindViewById<CheckBox>(Resource.Id.login_showpwd);//显示密码
            chk_login = FindViewById<CheckBox>(Resource.Id.login_checklogin);//自动登录
            text = FindViewById<TextView>(Resource.Id.login_text);//底部说明文字
            #endregion

            int li_row = SqliteHelper.ExecuteNum("select count(*) from customer");
            if (li_row <= 0)
            {
                text.Text = "首次登陆时需要从服务器获取大量数据\n可能需要几分钟甚至更长时间\n建议在网络条件较好的环境下操作\n获取数据过程中请不要关闭程序";
            }
            string CompanyList = _publicfuns.of_GetMySysSet("Login", "CompanyList");
            string CompanyHost = _publicfuns.of_GetMySysSet("Login", "CompanyHost");
            //未获取到本地数据  从服务器获取
            if (string.IsNullOrEmpty(CompanyList) || string.IsNullOrEmpty(CompanyHost))
            {
                Intent it = new Intent();
                Bundle bu = new Bundle();
                bu.PutString("name", "login");
                it.PutExtras(bu);
                it.SetClass(this.ApplicationContext, typeof(Loading));
                StartActivity(it);
                Finish();
                return;
            }
            string[] list = { };
            if (CompanyList.Substring(0, 2) == "OK")
            {
                list = CompanyList.Substring(2).Split(',');
            }
            if (CompanyHost.Substring(0, 2) == "OK")
            {
                _publicfuns.of_SetMySysSet("Login", "CompanyHost", CompanyHost);
            }
            #region 为控件绑定数据
            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            for (int i = 0; i < list.Length; i++)
            {
                adapter.Add(list[i]);
            }
            spinner.Adapter = adapter;
            spinner.SetSelection(list.Length - 1, true);//默认选中项

            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            DataTable ldt = new DataTable();
            ldt = SqliteHelper.ExecuteDataTable("select groupname from mygroup");
            for (int i = 0; i < ldt.Rows.Count; i++)
            {
                adapter.Add(ldt.Rows[i]["groupname"].ToString());
            }
            spinner_mygroup.Adapter = adapter;

            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            ldt = new DataTable();
            string ls_gid = "";
            ls_gid = SqliteHelper.ExecuteScalar("select gid from mygroup");
            ldt = SqliteHelper.ExecuteDataTable("select username from myuser where gid='" + ls_gid + "'");
            for (int i = 0; i < ldt.Rows.Count; i++)
            {
                adapter.Add(ldt.Rows[i]["username"].ToString());
            }
            username.Adapter = adapter;
            #endregion

            spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinner_mygroup.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(group_ItemSelected);

            chk_showpwd.CheckedChange += delegate
            {
                if (chk_showpwd.Checked)
                {
                    password.InputType = Android.Text.InputTypes.TextVariationWebEditText;
                }
                else
                {
                    password.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword;
                }
                password.SetSelection(password.Text.Length);
            };

            btn_cancel.Click += delegate
            {
                SysVisitor.EXIT(this);
            };

            //登陆
            btn_login.Click += delegate
            {
                string local_user = _publicfuns.of_GetMySysSet("Login", "username");
                string local_pwd = _publicfuns.of_GetMySysSet("Login", "password");
                string local_logindate = _publicfuns.of_GetMySysSet("Login", "logindate");

                string ls_username = username.SelectedItem.ToString();
                string ls_password = password.Text;

                string ls_Login = "";
                DateTime time;
                try
                {
                    time = Convert.ToDateTime(local_logindate);
                }
                catch
                {
                    time = DateTime.Now.AddDays(-100);
                }
                #region 本地登陆
                if (SysVisitor.DateDiff(time.ToString(), SysVisitor.timeSpan.Days) <= 7)
                {
                    if (!string.IsNullOrEmpty(local_user) && !string.IsNullOrEmpty(local_pwd))
                    {
                        if (local_user == ls_username && local_pwd == baseclass.DES.of_EncryStr_64(ls_password, "loginpasskey"))
                        {
                            ls_Login = "******";//本地账号密码校验成功
                                            //测试时关闭本地校验
                        }
                    }
                }
                if (string.IsNullOrEmpty(ls_Login))//未完成本地登陆
                {
                    if (!SysVisitor.isNetworkConnected(this))
                    {
                        Toast.MakeText(this, "当前网络不可用,请检查你的网络设置", ToastLength.Short).Show();
                        return;
                    }
                    string ls_error = YW.of_GetCompanyList(ls_DeviceId);
                    if (ls_error.Substring(0, 2) != "OK")
                    {
                        //Toast.MakeText(this, "该手机未注册,请重新注册", ToastLength.Long).Show();
                        //return;
                        StartActivity(typeof(enroll));
                        Finish();
                        return;
                    }
                    YW.of_GetERPurl(SysVisitor.Get_Comname(), ls_DeviceId);
                    ls_error = YW.of_CheckNetWorkOK();
                    if (ls_error != "OK")
                    {
                        Toast.MakeText(this, "未能成功连接服务器,请重试", ToastLength.Short).Show();
                        return;
                    }
                    ls_Login = YW.Of_loginYW(SysVisitor.Get_Comname(), ls_username, ls_password);//登陆
                }
                #endregion
                //YW.SendMessage_MygroupUser_json();
                if (string.IsNullOrEmpty(ls_username) || string.IsNullOrEmpty(ls_password))
                {
                    Toast.MakeText(this, "用户名或密码不能为空", ToastLength.Short).Show();
                }
                #region 登陆成功
                if (ls_Login == "OK")
                {
                    _publicfuns.of_SetMySysSet("Login", "username", ls_username);
                    _publicfuns.of_SetMySysSet("Login", "password", baseclass.DES.of_EncryStr_64(ls_password, "loginpasskey"));
                    _publicfuns.of_SetMySysSet("Login", "logindate", DateTime.Now.ToString());
                    if (chk_login.Checked)//下次自动登录
                    {
                        _publicfuns.of_SetMySysSet("Login", "Login", "Y");
                    }
                    else
                    {
                        _publicfuns.of_SetMySysSet("Login", "Login", "N");
                    }
                    //登陆成功
                    string ls_row = SqliteHelper.ExecuteScalar("select count(*) from customer_small");
                    int row = 0;
                    try
                    {
                        row = int.Parse(ls_row);
                    }
                    catch { }
                    Toast.MakeText(this, "登陆成功", ToastLength.Short).Show();
                    Intent it = new Intent();
                    Bundle bu = new Bundle();
                    bu.PutString("name", "data");
                    bu.PutString("update", "");
                    it.PutExtras(bu);
                    if (row <= 0)
                    {
                        it.SetClass(this.ApplicationContext, typeof(Loading));
                    }
                    else
                    {
                        it.SetClass(this.ApplicationContext, typeof(Index));
                    }
                    SysVisitor.UserName = ls_username;
                    StartActivity(it);
                    Finish();
                }
                #endregion
                else
                {
                    Toast.MakeText(this, "登陆失败,请检查用户名密码", ToastLength.Short).Show();
                }
            };

            //Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService);
            //imm.HideSoftInputFromWindow(btn_login.WindowToken, Android.Views.InputMethods.HideSoftInputFlags.None);
            //刷新登陆数据
            Refresh.Click += delegate
            {
                Intent it = new Intent();
                Bundle bu = new Bundle();
                bu.PutString("name", "login");
                it.PutExtras(bu);
                it.SetClass(this.ApplicationContext, typeof(Loading));
                StartActivity(it);
                Finish();
            };

            ImageButton netType_del = FindViewById<ImageButton>(Resource.Id.Index_netType_del);
            LinearLayout netType_view = FindViewById<LinearLayout>(Resource.Id.Index_netType_LinearLayout);
            TextView netType = FindViewById<TextView>(Resource.Id.Index_netType_text);
            netType_del.Click += delegate { netType_view.Visibility = ViewStates.Gone; ab_shouNetType = true; };
            netType.Click += delegate
            {
                Intent intent = null;
                if (int.Parse(Android.OS.Build.VERSION.Sdk) > 10)
                {
                    intent = new Intent(Android.Provider.Settings.ActionWirelessSettings);
                }
                else
                {
                    intent = new Intent();
                    ComponentName component = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
                    intent.SetComponent(component);
                    intent.SetAction("android.intent.action.VIEW");
                }
                StartActivity(intent);
            };
            System.Threading.Thread thr = new System.Threading.Thread(new System.Threading.ThreadStart(of_netType));
            thr.Start();
        }
Example #14
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Edit);
            Car car = null;

            try
            {
                car = await HttpManager.HttpGet <Car>(String.Format(HttpManager.GetHostAddress() + "/cars/{0}", Intent.GetLongExtra(CarIdExtras, 0)));
            }
            catch (WebException e)
            {
                DialogProvider.ShowOkDialogWithoutAction(this, "Connection lost!", "Connection", (sender, args) => { Finish(); });
                return;
            }



            _backButton     = FindViewById <Button>(Resource.Id.BackButton);
            _brandEdit      = FindViewById <EditText>(Resource.Id.BrandEdit);
            _typeEdit       = FindViewById <EditText>(Resource.Id.TypeEdit);
            _stateEdit      = FindViewById <Spinner>(Resource.Id.StateEdit);
            _kilometersEdit = FindViewById <EditText>(Resource.Id.KilometersEdit);
            _powerEdit      = FindViewById <EditText>(Resource.Id.PowerEdit);
            _torqueEdit     = FindViewById <EditText>(Resource.Id.TorqueEdit);
            _priceEdit      = FindViewById <EditText>(Resource.Id.PriceEdit);
            _editButton     = FindViewById <Button>(Resource.Id.EditButton);

            _pictureLoadButton = FindViewById <Button>(Resource.Id.PictureLoadButton);
            _imageUrlEditText  = FindViewById <EditText>(Resource.Id.PictureUrlEditText);
            _loadedPicture     = FindViewById <ImageView>(Resource.Id.LoadedPictureImageView);

            _brandEdit.Text        = car.Brand;
            _typeEdit.Text         = car.Type;
            _kilometersEdit.Text   = car.Kilometers.ToString();
            _powerEdit.Text        = car.Power.ToString();
            _torqueEdit.Text       = car.Torque.ToString();
            _priceEdit.Text        = car.Price.ToString();
            _imageUrlEditText.Text = car.Picture;


            Bitmap curentBmp = null;

            await Task.Run(() => { curentBmp = BitmapDownloader.GetImageBitmapFromUrl(_imageUrlEditText.Text); });

            _loadedPicture.SetImageBitmap(curentBmp);


            ArrayAdapter <string> adapter = new ArrayAdapter <string>(this,
                                                                      Android.Resource.Layout.SimpleSpinnerItem, CarStateManager.GetItems());

            _stateEdit.Adapter = adapter;

            _stateEdit.SetSelection(CarStateManager.GetItemPossition(car.State));

            _backButton.Click += (sender, args) =>
            {
                Finish();
            };

            _pictureLoadButton.Click += async(sender, args) =>
            {
                _imageUrlEditText.Enabled = false;
                _loadedPicture.Enabled    = false;
                _loadedPicture.SetImageBitmap(null);
                Bitmap bmp = null;

                await Task.Run(() => { bmp = BitmapDownloader.GetImageBitmapFromUrl(_imageUrlEditText.Text); });

                _loadedPicture.SetImageBitmap(bmp);
                _imageUrl = _imageUrlEditText.Text;
                _imageUrlEditText.Enabled = true;
                _loadedPicture.Enabled    = true;
            };

            _editButton.Click += async(sender, args) =>
            {
                if (int.TryParse(_kilometersEdit.Text, out int kilometers) &&
                    int.TryParse(_powerEdit.Text, out int power) &&
                    int.TryParse(_torqueEdit.Text, out int torque) &&
                    float.TryParse(_priceEdit.Text, out float price))
                {
                    Car editCar = new Car();
                    editCar.Brand      = _brandEdit.Text;
                    editCar.Type       = _typeEdit.Text;
                    editCar.State      = CarStateManager.ConvertCarStateToDatabaseValue(_stateEdit.SelectedItem.ToString());
                    editCar.Kilometers = kilometers;
                    editCar.Power      = power;
                    editCar.Torque     = torque;
                    editCar.Price      = price;
                    editCar.Picture    = _imageUrl;
                    try
                    {
                        await HttpManager.HttpPut(editCar, HttpManager.GetHostAddress() + "/cars/" + car.Id);

                        Finish();
                    }
                    catch (WebException e)
                    {
                        DialogProvider.ShowOkDialogWithoutAction(this, "Connection lost!", "Connection", null);
                    }
                }
                else
                {
                    DialogProvider.ShowOkDialogWithoutAction(this, "Some informations are not correct", "Error", null);
                }
            };
        }
Example #15
0
        private void UpdateDisplay()
        {
            bool requestFwUpdate = false;
            bool bEnabled        = !IsJobRunning();
            bool fwUpdateEnabled = bEnabled;
            bool expertMode      = _checkBoxExpert.Checked;

            _buttonRead.Enabled    = bEnabled;
            _buttonWrite.Enabled   = bEnabled;
            _editTextBtPin.Enabled = bEnabled && _btPin != null && _btPin.Length >= 4;
            int maxPinLength = (_btPin != null && _btPin.Length > 0) ? _btPin.Length : 4;

            _editTextBtPin.SetFilters(new Android.Text.IInputFilter[] { new Android.Text.InputFilterLengthFilter(maxPinLength) });
            if (!_editTextBtPin.Enabled)
            {
                _editTextBtPin.Text = string.Empty;
            }
            _editTextBtName.Enabled = bEnabled && _btName != null && _btName.Length > 0;
            int maxTextLength = (_btName != null && _btName.Length > 0) ? _btName.Length : 16;

            _editTextBtName.SetFilters(new Android.Text.IInputFilter[] { new Android.Text.InputFilterLengthFilter(maxTextLength) });
            if (!_editTextBtName.Enabled)
            {
                _editTextBtName.Text = string.Empty;
            }

            _textViewSerNum.Enabled = bEnabled;

            if (bEnabled)
            {
                if ((_separationTime < 0) || (_separationTime >= _spinnerCanAdapterSepTimeAdapter.Items.Count))
                {
                    _spinnerCanAdapterSepTime.SetSelection(0);
                }
                else
                {
                    _spinnerCanAdapterSepTime.SetSelection(_separationTime);
                    if (_separationTime != 0)
                    {
                        expertMode = true;
                    }
                }

                if ((_blockSize < 0) || (_blockSize >= _spinnerCanAdapterBlockSizeAdapter.Items.Count))
                {
                    _spinnerCanAdapterBlockSize.SetSelection(0);
                }
                else
                {
                    _spinnerCanAdapterBlockSize.SetSelection(_blockSize);
                    if (_blockSize != 0)
                    {
                        expertMode = true;
                    }
                }

                // moved down because of expert mode setting
                if (_activityCommon.SelectedInterface == ActivityCommon.InterfaceType.Bluetooth)
                {
                    if (_canMode == (int)AdapterMode.Can100)
                    {
                        expertMode = true;
                    }
                    _spinnerCanAdapterModeAdapter.Items.Clear();
                    if (_adapterType >= 0x0002 && _fwVersion >= 0x0008)
                    {
                        _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_auto), AdapterMode.CanAuto));
                    }
                    _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_500), AdapterMode.Can500));
                    if (expertMode)
                    {
                        _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_100), AdapterMode.Can100));
                    }
                    _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_off), AdapterMode.CanOff));
                    _spinnerCanAdapterModeAdapter.NotifyDataSetChanged();

                    int indexMode = 0;
                    for (int i = 0; i < _spinnerCanAdapterModeAdapter.Count; i++)
                    {
                        if ((int)_spinnerCanAdapterModeAdapter.Items[i].Data == _canMode)
                        {
                            indexMode = i;
                        }
                    }
                    _spinnerCanAdapterMode.SetSelection(indexMode);
                }

                if (_editTextBtPin.Enabled && _btPin != null)
                {
                    string btPin = PinDataToString(_btPin);
                    _editTextBtPin.Text = btPin.Length >= 4 ? btPin : "1234";
                }

                if (_editTextBtName.Enabled && _btName != null)
                {
                    try
                    {
                        int length = _btName.TakeWhile(value => value != 0x00).Count();
                        _editTextBtName.Text = Encoding.UTF8.GetString(_btName, 0, length);
                    }
                    catch (Exception)
                    {
                        _editTextBtName.Text = string.Empty;
                    }
                }

                string ignitionText = string.Empty;
                if (_ignitionState >= 0)
                {
                    ignitionText = (_ignitionState & 0x01) != 0x00 ? GetString(Resource.String.can_adapter_ignition_on) : GetString(Resource.String.can_adapter_ignition_off);
                    if ((_ignitionState & 0x80) != 0)
                    {
                        ignitionText = "(" + ignitionText + ")";
                    }
                }
                _textViewIgnitionState.Text = ignitionText;

                string voltageText = string.Empty;
                if (_adapterType > 1 && _batteryVoltage >= 0)
                {
                    voltageText = string.Format(ActivityMain.Culture, "{0,4:0.0}V", (double)_batteryVoltage / 10);
                }
                _textViewBatteryVoltage.Text = voltageText;

                string versionText = string.Empty;
                if (_adapterType >= 0 && _fwVersion >= 0)
                {
                    versionText = string.Format(ActivityMain.Culture, "{0}.{1} / ", (_fwVersion >> 8) & 0xFF, _fwVersion & 0xFF);
                    int fwUpdateVersion = PicBootloader.GetFirmwareVersion((uint)_adapterType);
                    if (fwUpdateVersion >= 0)
                    {
                        if (!_fwUpdateShown && _fwVersion < fwUpdateVersion)
                        {
                            requestFwUpdate = true;
                        }
                        versionText += string.Format(ActivityMain.Culture, "{0}.{1}", (fwUpdateVersion >> 8) & 0xFF, fwUpdateVersion & 0xFF);
                    }
                    else
                    {
                        versionText += "--";
                    }
                    fwUpdateEnabled = fwUpdateVersion >= 0 && ((_fwVersion != fwUpdateVersion) || ActivityCommon.CollectDebugInfo);
                }
                _textViewFwVersion.Text = versionText;

                if (_textViewSerNum.Enabled)
                {
                    _textViewSerNum.Text = (_serNum == null) ? string.Empty : BitConverter.ToString(_serNum).Replace("-", "");
                }
            }
            _buttonFwUpdate.Enabled             = fwUpdateEnabled;
            _spinnerCanAdapterMode.Enabled      = bEnabled;
            _spinnerCanAdapterSepTime.Enabled   = bEnabled && expertMode;
            _spinnerCanAdapterBlockSize.Enabled = bEnabled && expertMode;
            _checkBoxExpert.Enabled             = bEnabled;
            _checkBoxExpert.Checked             = expertMode;
            if (requestFwUpdate)
            {
                _fwUpdateShown = true;
                new AlertDialog.Builder(this)
                .SetPositiveButton(Resource.String.button_yes, (sender, args) =>
                {
                    PerformUpdateMessage();
                })
                .SetNegativeButton(Resource.String.button_no, (sender, args) =>
                {
                })
                .SetCancelable(true)
                .SetMessage(Resource.String.can_adapter_fw_update_present)
                .SetTitle(Resource.String.alert_title_question)
                .Show();
            }

            HideKeyboard();
        }
Example #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            //Find controls
            SetContentView(Resource.Layout.NoteEditScreen);
            nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
            descriptionTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
            imagePreview = FindViewById<ImageView>(Resource.Id.NoteImage);
            saveButton = FindViewById<Button>(Resource.Id.SaveButton);
            pickImageButton = FindViewById<Button>(Resource.Id.PickImageButton);
            prioritySpinner = FindViewById<Spinner> (Resource.Id.PrioritySpinner);
            cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);
            dateDisplay = FindViewById<TextView> (Resource.Id.DateDisplay);
            timeDisplay = FindViewById<TextView> (Resource.Id.TimeDisplay);
            pickDate = FindViewById<Button> (Resource.Id.PickDate);
            pickTime = FindViewById<Button> (Resource.Id.PickTime);

            cancelDeleteButton.Text = Resources.GetText (Resource.String.Cancel);
            selectedDateTime = DateTime.Now;
            UpdateDisplay ();

            // Get note if exist
            int noteID = Intent.GetIntExtra("NoteID", 0);
            if(noteID > 0) {
                note = NoteItemManager.GetNote(noteID);

                nameTextEdit.Text = note.Name;
                descriptionTextEdit.Text = note.Description;
                prioritySpinner.SetSelection(note.Priority);

                cancelDeleteButton.Text = Resources.GetText (Resource.String.Delete);

                selectedDateTime = note.ToDoDate;
                selectedImageUri = note.ImageUri;
                selectedPriority = note.Priority;

                UpdateDisplay ();
            }

            //Image button
            pickImageButton.Click += (sender, eventArgs) =>
            {
                Intent = new Intent();
                Intent.SetType("image/*");
                Intent.SetAction(Intent.ActionGetContent);
                StartActivityForResult(Intent.CreateChooser(Intent, Resources.GetText (Resource.String.SelectPicture)), PickImageId);
            };

            //DateTime
            pickDate.Click += delegate { ShowDialog (PickDateId); };
            pickTime.Click += delegate { ShowDialog (PickTimeId); };

            //Priority spinner
            prioritySpinner.ItemSelected += PrioritySpinner_ItemSelected;
            var adapter = ArrayAdapter.CreateFromResource (
                this, Resource.Array.priorities, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            prioritySpinner.Adapter = adapter;

            //Buttons clicks
            cancelDeleteButton.Click += (sender, e) => CancelDelete ();
            saveButton.Click += (sender, e) => Save ();
        }
Example #17
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            base.OnCreateView (inflater, container, savedInstanceState);

            View rootView = inflater.Inflate (Resource.Layout.Block1Fragment, container, false);

            pharmacyID = Arguments.GetInt (Common.PHARMACY_ID);
            user = Common.GetCurrentUser ();
            netCategories = Common.GetNetCategories (user.username);
            promos = Common.GetPromos (user.username);
            merchant = Common.GetMerchant (user.username);
            territory = Common.GetTerritory (user.username);
            pharmacy = PharmacyManager.GetPharmacy (pharmacyID);

            var tradenets = Common.GetTradeNets (user.username);
            Dictionary <int, string> tnDict = new Dictionary<int, string> ();
            foreach (var item in tradenets) {
                tnDict.Add (item.id, item.shortName);
            };

            attendance = AttendanceManager.GetCurrentAttendance ();
            if (attendance == null) {
                attendance = AttendanceManager.GetLastAttendance (pharmacyID);

                if (attendance == null) {
                    attendance = new Attendance () {
                        pharmacy = pharmacyID,
                        date = DateTime.Now,
                        merchant = merchant.id
                    };
                } else {
                    attendance.id = -1;
                    attendance.date = DateTime.Now;
                }
            }

            rootView.FindViewById<TextView> (Resource.Id.b1fTradenetText).Text = tnDict [pharmacy.tradenet];//@"Аптечная Сеть";
            rootView.FindViewById<TextView> (Resource.Id.b1fCityText).Text = territory.baseCity;
            rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyNameText).Text = pharmacy.shortName;
            rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyAddressText).Text = pharmacy.address;
            rootView.FindViewById<TextView> (Resource.Id.b1fCategoryInOTCText).Text = pharmacy.category_otc;
            rootView.FindViewById<TextView> (Resource.Id.b1fLastAttendanceText).Text = pharmacy.prev == DateTime.MinValue ? String.Empty : pharmacy.prev.ToString (@"d");
            rootView.FindViewById<TextView> (Resource.Id.b1fNextAttendanceText).Text = pharmacy.next == DateTime.MinValue ? String.Empty : pharmacy.next.ToString (@"d");
            rootView.FindViewById<TextView> (Resource.Id.b1fAllAttendanciesText).Text = AttendanceManager.GetStatistics(pharmacy.id);

            categoryNetSpinner = rootView.FindViewById<Spinner> (Resource.Id.b1fCategoryNetSpinner);
            ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, (from item in netCategories select item.key).ToArray<string>());
            adapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
            categoryNetSpinner.Adapter = adapter;
            categoryNetSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                attendance.category_net = netCategories[e.Position].id;
            };
            // SetValue
            for (int i = 0; i < netCategories.Count; i++) {
                if (netCategories [i].id == attendance.category_net) {
                    categoryNetSpinner.SetSelection (i);
                }
            }

            telephoneEdit = rootView.FindViewById<EditText> (Resource.Id.b1fTelephoneEdit);
            telephoneEdit.Text = attendance.telephone;

            purchaserFIOEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPurchaserFIOEdit);
            purchaserFIOEdit.Text = attendance.purchaserFIO;

            promosEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPromosEdit);
            promosButton = rootView.FindViewById<Button> (Resource.Id.b1fPromosButton);
            promosButton.Click += (object sender, EventArgs e) => {
                bool[] checkedItems = new bool[promos.Count];
                if (attendance.promos != null) {
                    for (int i = 0; i < promos.Count; i++) {
                        if(attendance.promos.Contains(promos[i].id)){
                            checkedItems[i] = true;
                            tempPromos.Add(promos[i].id);
                        }
                    }
                }
                string[] items = (from promo
                                 	in promos
                                orderby promo.id
                                 select promo.name).ToArray<string>();
                AlertDialog.Builder builder;
                builder = new AlertDialog.Builder(Activity);
                builder.SetTitle("Выбор ПРОМО-матералов");
                builder.SetCancelable(false);
                builder.SetMultiChoiceItems(items, checkedItems, MultiListClicked);
                builder.SetPositiveButton(@"Сохранить",
                    delegate {
                        attendance.promos = tempPromos.ToArray<int>();
                        builder.Dispose();
                        RefreshPromos();
                    }
                );
                builder.SetNegativeButton(@"Отмена", delegate { builder.Dispose(); });
                builder.Show();
            };
            RefreshPromos();

            pharmacistCountEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPharmacistCountEdit);
            pharmacistCountEdit.Text = attendance.pharmacistCount.ToString ();

            commentEdit = rootView.FindViewById<EditText> (Resource.Id.b1fCommentEdit);
            commentEdit.Text = attendance.comment;

            RefreshControlsState ();
            return rootView;
        }
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			RequestWindowFeature (Android.Views.WindowFeatures.NoTitle);
			SetContentView(Resource.Layout.activity_custom);

			_progressBar = (Castorflex.SmoothProgressBar.SmoothProgressBar) FindViewById(Resource.Id.progressbar);
			_checkBoxMirror = FindViewById<CheckBox>(Resource.Id.checkbox_mirror);
			_checkBoxReversed = FindViewById<CheckBox>(Resource.Id.checkbox_reversed);
			_spinnerInterpolators = FindViewById<Spinner>(Resource.Id.spinner_interpolator);
			_seekBarSectionsCount = FindViewById<SeekBar>(Resource.Id.seekbar_sections_count);
			_seekBarStrokeWidth = FindViewById<SeekBar>(Resource.Id.seekbar_stroke_width);
			_seekBarSeparatorLength = FindViewById<SeekBar>(Resource.Id.seekbar_separator_length);
			_seekBarSpeed = FindViewById<SeekBar>(Resource.Id.seekbar_speed);
			_seekBarFactor = FindViewById<SeekBar>(Resource.Id.seekbar_factor);
			_textViewSpeed =FindViewById<TextView>(Resource.Id.textview_speed);
			_textViewSectionsCount = FindViewById<TextView>(Resource.Id.textview_sections_count);
			_textViewSeparatorLength =FindViewById<TextView>(Resource.Id.textview_separator_length);
			_textViewStrokeWidth = FindViewById<TextView>(Resource.Id.textview_stroke_width);
			_textViewFactor = FindViewById<TextView>(Resource.Id.textview_factor);

			FindViewById (Resource.Id.button_start).Click += (object sender, System.EventArgs e) => {
				_progressBar.ProgressiveStart();
			};
			FindViewById (Resource.Id.button_stop).Click += (object sender, System.EventArgs e) => {
				_progressBar.ProgressiveStop();
			};
			_seekBarFactor.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
				_factor = (e.Progress + 1) / 10f;
				_textViewFactor.Text="Factor: " + _factor;
				SetInterpolator(_spinnerInterpolators.SelectedItemPosition);
			};
			_seekBarSpeed.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
				_speed = ((float) e.Progress + 1) / 10;
				_textViewSpeed.Text="Speed: " + _speed;
				_progressBar.SetSmoothProgressDrawableSpeed(_speed);
				_progressBar.SetSmoothProgressDrawableProgressiveStartSpeed(_speed);
				_progressBar.SetSmoothProgressDrawableProgressiveStopSpeed(_speed);
			};
			_seekBarSectionsCount.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
				_sectionsCount = e.Progress + 1;
				_textViewSectionsCount.Text="Sections count: " + _sectionsCount;
				_progressBar.SetSmoothProgressDrawableSectionsCount(_sectionsCount);
			};
			_seekBarSeparatorLength.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
				_separatorLength = e.Progress;
				_textViewSeparatorLength.Text=string.Format("Separator length: {0}dp", _separatorLength);
				_progressBar.SetSmoothProgressDrawableSeparatorLength(DpToPx(_separatorLength));
			};
			_seekBarStrokeWidth.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => {
				_strokeWidth =e.Progress;
				_textViewStrokeWidth.Text=string.Format("Stroke width: {0}dp", _strokeWidth);
				_progressBar.SetSmoothProgressDrawableStrokeWidth(DpToPx(_strokeWidth));
			};
			_checkBoxMirror.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				_progressBar.SetSmoothProgressDrawableMirrorMode(e.IsChecked);
			};
			_checkBoxReversed.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
				_progressBar.SetSmoothProgressDrawableReversed(e.IsChecked);
			};
			_seekBarSeparatorLength.Progress=4;
			_seekBarSectionsCount.Progress=4;
			_seekBarStrokeWidth.Progress=4;
			_seekBarSpeed.Progress=9;
			_seekBarFactor.Progress=9;

			_spinnerInterpolators.Adapter=new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, Resources.GetStringArray(Resource.Array.interpolators));
			_spinnerInterpolators.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
				SetInterpolator(e.Position);
			};    _spinnerInterpolators.SetSelection(0);
		}
Example #19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            var label = FindViewById<TextView>(Resource.Id.tv1);
            button.Click += delegate {
                count++;
                label.Text = $"你點擊了 {count} 次";
                //button.Text = string.Format("{0} clicks!", count++);
            };

            ad = FindViewById<ImageView>(Resource.Id.AD);
            ad.SetImageResource(Resource.Drawable.pikachu);

            // Get local Bluetooth adapter
            mBluetoothAdapter = BluetoothAdapter.DefaultAdapter;

            // If the adapter is null, then Bluetooth is not supported
            if (mBluetoothAdapter == null)
            {
                Toast.MakeText(this, "Bluetooth is not available", ToastLength.Long).Show();
                Finish();
                return;
            }

            //---------------------SPINNER-------------------------------
            spinner_mode = FindViewById<Spinner>(Resource.Id.spinner1);

            AppPreferences ap = new AppPreferences(mContext);
            int spinnerPos = ap.getAccessKey();

            spinner_mode.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                    this, Resource.Array.Connect_Mode_Array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner_mode.Adapter = adapter;

            if (spinner_mode != null)
            {
                spinner_mode.SetSelection(ap.getAccessKey());
            }
        }
Example #20
0
        public override void OnStart ()
        {
            base.OnStart ();

            _edName = _activity.FindViewById<EditText>(Resource.Id.edGeneralName);
            _edNummer = _activity.FindViewById<EditText> (Resource.Id.edNummer);
            _edStrasse = _activity.FindViewById<EditText> (Resource.Id.edStrasse);
            _edPLZ = _activity.FindViewById<EditText> (Resource.Id.edPLZ);
            _edOrt = _activity.FindViewById<EditText> (Resource.Id.edOrt);
            _edTelefon = _activity.FindViewById<EditText> (Resource.Id.edTelefon);
            _edEmail = _activity.FindViewById<EditText> (Resource.Id.edEmail);
            _tvEmail = _activity.FindViewById<TextView> (Resource.Id.tvEmail);
            _tvTelefon = _activity.FindViewById<TextView>(Resource.Id.tvTelefon);
            _edSperrdatum = _activity.FindViewById<EditText>(Resource.Id.edSperrdatum);
            _edSperrgrund = _activity.FindViewById<EditText>(Resource.Id.edSperrgrund);
            _btnClear = _activity.FindViewById<ImageButton>(Resource.Id.btnClearSperrDatum);

            _spinnerLand = _activity.FindViewById<Spinner> (Resource.Id.spinnerLand);
            CountryViewAdapter _adapterCountry = new CountryViewAdapter (_activity);

            // New Handler, not to forget to unsubscribe in the OnPause Event 
            // important, because when another activity (like Setting) overpaints the MainActivity and hides again OnStart will be called again and then this events is called twice!!
            _spinnerLand.Touch += SpinnerLand_Touch;

            _spinnerLand.Adapter = _adapterCountry;

            _btnClear.Click += (object sender, EventArgs e) => {
                _edSperrdatum.Text  = "";
            };

            // Check for object instance
            if (_stateFragment == null || _stateFragment._stateClass == null)
                return;


            if (_stateFragment._stateClass._person != null)
            {
                _edName.Text = _stateFragment._stateClass._person.ID;
                _edName.Text = _stateFragment._stateClass._person.GetID ();
                _edName.Text = _stateFragment._stateClass._person.Name;
                _edNummer.Text = _stateFragment._stateClass._person.Nummer;
                _edStrasse.Text = _stateFragment._stateClass._person.Strasse;
                _edPLZ.Text =_stateFragment._stateClass._person.PLZ;
                _edOrt.Text =_stateFragment._stateClass._person.Ort;
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex (_stateFragment._stateClass._person.LandNummer));
                _edTelefon.Text =_stateFragment._stateClass._person.Telefon;
                _edEmail.Text = _stateFragment._stateClass._person.Email;
                _tvEmail.Text = _stateFragment._stateClass._person.Email;
                _tvTelefon.Text = _stateFragment._stateClass._person.Telefon;
                _edSperrdatum.Text = _stateFragment._stateClass._person.Sperrdatum;
                _edSperrgrund.Text = _stateFragment._stateClass._person.Sperrgrund;
            }

            // Disable the controls if necessary
            _stateFragment.GetControlReferences();
            if (_edName.Enabled == false)
                _stateFragment.DisableControls();
        }
Example #21
0
        private Spinner sp_subcomLocal; //开卡店

        #endregion Fields

        #region Methods

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.OutOne);

            IntentName = Intent.GetStringExtra("cardno");//卡号
            #region 初始化控件
            ibtn_cancel = FindViewById<ImageButton>(Resource.Id.OutOne_cancel);
            btn_save = FindViewById<Button>(Resource.Id.OutOne_save);
            sp_subcom = FindViewById<Spinner>(Resource.Id.OutOne_SubCom);//选择分店
            et_search = FindViewById<EditText>(Resource.Id.OutOne_Search);//搜索
            et_cusname = FindViewById<EditText>(Resource.Id.OutOne_CusName);//姓名
            sp_sex = FindViewById<Spinner>(Resource.Id.OutOne_Sex);//性别
            sp_subcomLocal = FindViewById<Spinner>(Resource.Id.OutOne_CusTypeLocal);//开卡店
            et_balance = FindViewById<EditText>(Resource.Id.OutOne_Balance);//充值余额
            sp_custype = FindViewById<Spinner>(Resource.Id.OutOne_CusType);//会员级别
            et_laststore = FindViewById<EditText>(Resource.Id.OutOne_Lastdate);//最后充值
            et_integral = FindViewById<EditText>(Resource.Id.OutOne_Integral);//现有积分
            et_discount = FindViewById<EditText>(Resource.Id.OutOne_Discount);//服务折扣
            et_memcard = FindViewById<EditText>(Resource.Id.OutOne_MemCard);//会员卡扣款
            et_customercard = FindViewById<EditText>(Resource.Id.OutOne_CustomerCard);//会员卡号
            et_ysmoney = FindViewById<EditText>(Resource.Id.OutOne_YsMoney);//应收金额
            et_ticketmoneybefore = FindViewById<EditText>(Resource.Id.OutOne_TicketMoneyBefore);//抵扣金额
            et_factmoney = FindViewById<EditText>(Resource.Id.OutOne_FactMoney);//实际应收
            et_carsh = FindViewById<EditText>(Resource.Id.OutOne_Crash);//补现金
            et_selfno = FindViewById<EditText>(Resource.Id.OutOne_Selfno);//手工单号
            et_memo = FindViewById<EditText>(Resource.Id.OutOne_Momo);//备注
            btn_Clean = FindViewById<Button>(Resource.Id.OutOne_Clean);//清除信息
            #endregion

            #region 指定不可编辑项
            et_cusname.Enabled = false;
            et_cusname.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_sex.Enabled = false;
            sp_sex.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_subcomLocal.Enabled = false;
            sp_subcomLocal.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_balance.Enabled = false;
            et_balance.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            sp_custype.Enabled = false;
            sp_custype.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_laststore.Enabled = false;
            et_laststore.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_integral.Enabled = false;
            et_integral.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_memcard.Enabled = false;
            et_memcard.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            et_customercard.Enabled = false;
            et_customercard.SetBackgroundColor(Android.Graphics.Color.ParseColor("#A9A9A9"));
            #endregion

            et_cusname.Text = "散客";

            #region Spinner控件赋值
            //性别
            Java.Lang.Object[] sex = { "请选择", "先生", "女士" };
            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, sex);
            sp_sex.Adapter = adapter;
            sp_sex.SetSelection(2, true);
            //所属分店
            string[] subcom = SysVisitor.GetArryList("select subno,comname from subcom");
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, subcom);
            sp_subcom.Adapter = adapter;
            //开卡店sp_subcomLocal
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, subcom);
            sp_subcomLocal.Adapter = adapter;
            //会员级别
            string[] custype = SysVisitor.GetArryList("select cardlevel, carcname from cardtype");
            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, custype);
            sp_custype.Adapter = adapter;
            #endregion
            if (!string.IsNullOrEmpty(IntentName))
            {
                Onbind(IntentName);
            }
            et_search.FocusChange += delegate
            {
                if (!et_search.HasFocus)
                {
                    string ls_search = et_search.Text.Trim();
                    if (!string.IsNullOrEmpty(ls_search))
                    {
                        Onbind(ls_search);
                    }

                }
            };
            //应收金额
            et_ysmoney.FocusChange += delegate
            {
                if (!et_ysmoney.HasFocus)
                {
                    if (et_ysmoney.Text.Trim() != "")
                    { CountMoney(); }
                }
            };
            //抵扣金额
            et_ticketmoneybefore.FocusChange += delegate
            {
                if (!et_ticketmoneybefore.HasFocus)
                {
                    if (et_ticketmoneybefore.Text.Trim() != "")
                    { CountMoney(); }
                }
            };
            //实际应收
            et_factmoney.FocusChange += delegate
            {
                if (!et_factmoney.HasFocus)
                {
                    if (et_factmoney.Text.Trim() != "")
                    { CountMoney(); }
                }
            };
            //补现金
            et_carsh.FocusChange += delegate
            {
                if (!et_carsh.HasFocus)
                {
                    if (et_carsh.Text.Trim() != "")
                    { CountMoney(); }
                }
            };

            btn_Clean.Click += delegate
            {
                IntentName = "";
                refresh();
            };
            //保存
            btn_save.Click += delegate
            {
                string ls_subcom = sp_subcom.SelectedItem == null ? "" : sp_subcom.SelectedItem.ToString();//所属分店
                if (ls_subcom == "请选择")
                    ls_subcom = "";
                else
                    ls_subcom = SqliteHelper.ExecuteScalar("select subno from subcom where comname='" + ls_subcom + "'");

                string ls_sex = sp_sex.SelectedItem.ToString();//性别
                if (ls_sex == "请选择")
                    ls_sex = "";
                if (ls_sex == "先生")
                    ls_sex = "Y";
                if (ls_sex == "女士")
                    ls_sex = "N";

                string ls_subcomLocal = sp_subcomLocal.SelectedItem == null ? "" : sp_subcomLocal.SelectedItem.ToString();//开卡店
                if (ls_subcomLocal == "请选择")
                    ls_subcomLocal = "";
                else
                    ls_subcomLocal = SqliteHelper.ExecuteScalar("select subno from subcom where comname='" + sp_subcomLocal + "'");

                string ls_custype = sp_custype.SelectedItem == null ? "" : sp_custype.SelectedItem.ToString();//会员级别
                if (ls_custype == "请选择")
                    ls_custype = "";
                else
                    ls_custype = SqliteHelper.ExecuteScalar("select cardlevel from cardtype where carcname='" + ls_custype + "'");

                string ls_et_cusname = et_cusname.Text;//姓名
                string ls_et_cardno = et_customercard.Text;//卡号
                string ls_et_discount = et_discount.Text;//服务折扣
                string ls_et_integral = et_integral.Text;//现有积分
                string ls_et_memcard = et_memcard.Text;//会员卡扣款
                string ls_et_ysmoney = et_ysmoney.Text;//应收金额
                string ls_et_ticketmoneybefore = et_ticketmoneybefore.Text;//抵扣金额
                string ls_et_factmoney = et_factmoney.Text;//实际应收
                string ls_et_carsh = et_carsh.Text;//补现金
                string ls_et_selfno = et_selfno.Text;//手工单号
                string ls_et_memo = et_memo.Text;//备注

                n_create_sql lnv_sql = new n_create_sql();
                lnv_sql.of_SetTable("outone");
                lnv_sql.of_AddCol("subno", ls_subcom);
                lnv_sql.of_AddCol("salecusname", ls_et_cusname);
                lnv_sql.of_AddCol("sex", ls_sex);
                lnv_sql.of_AddCol("subcom", ls_subcomLocal);
                lnv_sql.of_AddCol("ysmoney", ls_et_ysmoney);
                lnv_sql.of_AddCol("ticketmoney_before", ls_et_ticketmoneybefore);
                lnv_sql.of_AddCol("subno", ls_subcom);
                lnv_sql.of_AddCol("selfno", ls_et_selfno);
                lnv_sql.of_AddCol("factmoney", ls_et_factmoney);
                lnv_sql.of_AddCol("carsh", et_carsh);
                lnv_sql.of_AddCol("discount", ls_et_discount);
                lnv_sql.of_AddCol("memcard", ls_et_memcard);
                lnv_sql.of_AddCol("customer_card", ls_et_cardno);
                lnv_sql.of_AddCol("memo", ls_et_memo);
                bool lb_ok = false;
                lb_ok = lnv_sql.of_execute();
                if(lb_ok)
                {

                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set the result to CANCELED.  This will cause the widget host to cancel
            // out of the widget placement if they press the back button.
            SetResult(Result.Canceled, new Intent().PutExtra(AppWidgetManager.ExtraAppwidgetId, mAppWidgetId));

            // Find the widget id from the intent.
            if (Intent != null && Intent.Extras != null)
            {
                mAppWidgetId = Intent.GetIntExtra(AppWidgetManager.ExtraAppwidgetId, AppWidgetManager.InvalidAppwidgetId);
            }

            if (mAppWidgetId == AppWidgetManager.InvalidAppwidgetId)
            {
                // If they gave us an intent without the widget id, just bail.
                Finish();
            }

            SetContentView(Resource.Layout.activity_widget_setup);

            wm = WeatherManager.GetInstance();

            // Setup location spinner
            locSpinner = FindViewById <Spinner>(Resource.Id.location_pref_spinner);
            locSummary = FindViewById <TextView>(Resource.Id.location_pref_summary);

            var comboList = new List <ComboBoxItem>()
            {
                new ComboBoxItem(GetString(Resource.String.pref_item_gpslocation), "GPS"),
                new ComboBoxItem(GetString(Resource.String.label_btn_add_location), "Search")
            };
            var favs = Task.Run(Settings.GetFavorites).Result;

            Favorites = new ReadOnlyCollection <LocationData>(favs);
            foreach (LocationData location in Favorites)
            {
                comboList.Insert(comboList.Count - 1, new ComboBoxItem(location.name, location.query));
            }

            locAdapter = new ArrayAdapter <ComboBoxItem>(
                this, Android.Resource.Layout.SimpleSpinnerItem,
                comboList);
            locAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            locAdapter.SetNotifyOnChange(true);
            locSpinner.Adapter = locAdapter;

            FindViewById(Resource.Id.location_pref).Click += (object sender, EventArgs e) =>
            {
                locSpinner.PerformClick();
            };
            locSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                CtsCancel();

                if (locSpinner.SelectedItem is ComboBoxItem item)
                {
                    locSummary.Text = item.Display;

                    if (item.Value.Equals("Search"))
                    {
                        mActionMode = StartSupportActionMode(mActionModeCallback);
                    }
                    else
                    {
                        selectedItem = item;
                    }
                }
                else
                {
                    selectedItem = null;
                }
                query_vm = null;
            };
            locSpinner.SetSelection(0);

            // Setup interval spinner
            refreshSpinner     = FindViewById <Spinner>(Resource.Id.interval_pref_spinner);
            var refreshSummary = FindViewById <TextView>(Resource.Id.interval_pref_summary);
            var refreshList    = new List <ComboBoxItem>();
            var refreshEntries = this.Resources.GetStringArray(Resource.Array.refreshinterval_entries);
            var refreshValues  = this.Resources.GetStringArray(Resource.Array.refreshinterval_values);

            for (int i = 0; i < refreshEntries.Length; i++)
            {
                refreshList.Add(new ComboBoxItem(refreshEntries[i], refreshValues[i]));
            }
            var refreshAdapter = new ArrayAdapter <ComboBoxItem>(
                this, Android.Resource.Layout.SimpleSpinnerItem,
                refreshList);

            refreshAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            refreshSpinner.Adapter = refreshAdapter;
            FindViewById(Resource.Id.interval_pref).Click += (object sender, EventArgs e) =>
            {
                refreshSpinner.PerformClick();
            };
            refreshSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                if (refreshSpinner.SelectedItem is ComboBoxItem item)
                {
                    refreshSummary.Text = item.Display;
                }
            };
            refreshSpinner.SetSelection(
                refreshList.FindIndex(item => item.Value.Equals(Settings.RefreshInterval.ToString())));

            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar));
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_arrow_back_white_24dp);

            mActionModeCallback.CreateActionMode  += OnCreateActionMode;
            mActionModeCallback.DestroyActionMode += OnDestroyActionMode;

            FindViewById(Resource.Id.search_fragment_container).Click += delegate
            {
                ExitSearchUi();
            };

            appBarLayout      = FindViewById <AppBarLayout>(Resource.Id.app_bar);
            collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);

            cts = new CancellationTokenSource();

            // Location Listener
            mLocListnr = new LocationListener();
            mLocListnr.LocationChanged += async(Android.Locations.Location location) =>
            {
                mLocation = location;
                await FetchGeoLocation();
            };

            if (!Settings.WeatherLoaded)
            {
                Toast.MakeText(this, GetString(Resource.String.prompt_setup_app_first), ToastLength.Short).Show();

                Intent intent = new Intent(this, typeof(SetupActivity))
                                .SetAction(AppWidgetManager.ActionAppwidgetConfigure)
                                .PutExtra(AppWidgetManager.ExtraAppwidgetId, mAppWidgetId);
                StartActivityForResult(intent, SETUP_REQUEST_CODE);
            }
        }
Example #23
0
        private void startMain()
        {
            mTabHost.CurrentTab = 0;

            mLlRemoteSurface = (LinearLayout)FindViewById(Resource.Id.llRemoteView);
            mLlLocalSurface  = (LinearLayout)FindViewById(Resource.Id.llLocalView);

            if (null == vieAndroidAPI)
            {
                vieAndroidAPI = new ViEAndroidJavaAPI(this);
            }
            if (0 > setupVoE() || 0 > viEAndroidJavaAPI.VideoEngine || 0 > viEAndroidJavaAPI.Init(enableTrace))
            {
                // Show dialog
                AlertDialog alertDialog = (new AlertDialog.Builder(this)).Create();
                alertDialog.SetTitle("WebRTC Error");
                alertDialog.SetMessage("Can not init video engine.");
                alertDialog.SetButton((int)DialogInterface.ButtonPositive, "OK", new OnClickListenerAnonymousInnerClassHelper(this));
                alertDialog.Show();
            }

            btSwitchCamera = (Button)FindViewById(Resource.Id.btSwitchCamera);
            if (cameraOrientations[0] != -1 && cameraOrientations[1] != -1)
            {
                btSwitchCamera.SetOnClickListener(this);
            }
            else
            {
                btSwitchCamera.Enabled = false;
            }
            btStartStopCall = (Button)FindViewById(Resource.Id.btStartStopCall);
            btStartStopCall.SetOnClickListener(this);
            FindViewById(Resource.Id.btExit).SetOnClickListener(this);

            // cleaning
            remoteSurfaceView = null;
            svLocal           = null;

            // Video codec
            mVideoCodecsStrings = viEAndroidJavaAPI.GetCodecs();
            spCodecType         = (Spinner)FindViewById(Resource.Id.spCodecType);
            spCodecType.OnItemSelectedListener = this;
            spCodecType.Adapter = new SpinnerAdapter(this, this, Resource.Layout.row, mVideoCodecsStrings);
            spCodecType.SetSelection(0);

            // Video Codec size
            spCodecSize = (Spinner)FindViewById(Resource.Id.spCodecSize);
            spCodecSize.OnItemSelectedListener = this;
            spCodecSize.Adapter = new SpinnerAdapter(this, this, Resource.Layout.row, mVideoCodecsSizeStrings);
            spCodecSize.SetSelection(mVideoCodecsSizeStrings.Length - 1);

            // Voice codec
            mVoiceCodecsStrings = viEAndroidJavaAPI.VoE_GetCodecs();
            spVoiceCodecType    = (Spinner)FindViewById(Resource.Id.spVoiceCodecType);
            spVoiceCodecType.OnItemSelectedListener = this;
            spVoiceCodecType.Adapter = new SpinnerAdapter(this, this, Resource.Layout.row, mVoiceCodecsStrings);
            spVoiceCodecType.SetSelection(0);
            // Find ISAC and use it
            for (int i = 0; i < mVoiceCodecsStrings.Length; ++i)
            {
                if (mVoiceCodecsStrings[i].Contains("ISAC"))
                {
                    spVoiceCodecType.SetSelection(i);
                    break;
                }
            }

            RadioGroup radioGroup = (RadioGroup)FindViewById(Resource.Id.radio_group1);

            radioGroup.ClearCheck();
            if (renderType == RenderType.OPENGL)
            {
                radioGroup.Check(Resource.Id.radio_opengl);
            }
            else if (renderType == RenderType.SURFACE)
            {
                radioGroup.Check(Resource.Id.radio_surface);
            }
            else if (renderType == RenderType.MEDIACODEC)
            {
                radioGroup.Check(Resource.Id.radio_mediacodec);
            }

            etRemoteIp      = (EditText)FindViewById(Resource.Id.etRemoteIp);
            etRemoteIp.Text = remoteIp;

            cbLoopback         = (CheckBox)FindViewById(Resource.Id.cbLoopback);
            cbLoopback.Checked = loopbackMode;

            cbStats         = (CheckBox)FindViewById(Resource.Id.cbStats);
            cbStats.Checked = isStatsOn;

            cbVoice         = (CheckBox)FindViewById(Resource.Id.cbVoice);
            cbVoice.Checked = enableVoice;

            cbVideoSend            = (CheckBox)FindViewById(Resource.Id.cbVideoSend);
            cbVideoSend.Checked    = enableVideoSend;
            cbVideoReceive         = (CheckBox)FindViewById(Resource.Id.cbVideoReceive);
            cbVideoReceive.Checked = enableVideoReceive;

            etVTxPort      = (EditText)FindViewById(Resource.Id.etVTxPort);
            etVTxPort.Text = Convert.ToString(destinationPortVideo);

            etVRxPort      = (EditText)FindViewById(Resource.Id.etVRxPort);
            etVRxPort.Text = Convert.ToString(receivePortVideo);

            etATxPort      = (EditText)FindViewById(Resource.Id.etATxPort);
            etATxPort.Text = Convert.ToString(destinationPortVoice);

            etARxPort      = (EditText)FindViewById(Resource.Id.etARxPort);
            etARxPort.Text = Convert.ToString(receivePortVoice);

            cbEnableNack         = (CheckBox)FindViewById(Resource.Id.cbNack);
            cbEnableNack.Checked = enableNack;

            cbEnableSpeaker      = (CheckBox)FindViewById(Resource.Id.cbSpeaker);
            cbEnableAGC          = (CheckBox)FindViewById(Resource.Id.cbAutoGainControl);
            cbEnableAGC.Checked  = enableAGC;
            cbEnableAECM         = (CheckBox)FindViewById(Resource.Id.cbAECM);
            cbEnableAECM.Checked = enableAECM;
            cbEnableNS           = (CheckBox)FindViewById(Resource.Id.cbNoiseSuppression);
            cbEnableNS.Checked   = enableNS;

            cbEnableDebugAPM         = (CheckBox)FindViewById(Resource.Id.cbDebugRecording);
            cbEnableDebugAPM.Checked = false;             // Disable APM debugging by default

            cbEnableVideoRTPDump         = (CheckBox)FindViewById(Resource.Id.cbVideoRTPDump);
            cbEnableVideoRTPDump.Checked = false;             // Disable Video RTP Dump

            cbEnableVoiceRTPDump         = (CheckBox)FindViewById(Resource.Id.cbVoiceRTPDump);
            cbEnableVoiceRTPDump.Checked = false;             // Disable Voice RTP Dump

            etRemoteIp.SetOnClickListener(this);
            cbLoopback.SetOnClickListener(this);
            cbStats.SetOnClickListener(this);
            cbEnableNack.SetOnClickListener(this);
            cbEnableSpeaker.SetOnClickListener(this);
            cbEnableAECM.SetOnClickListener(this);
            cbEnableAGC.SetOnClickListener(this);
            cbEnableNS.SetOnClickListener(this);
            cbEnableDebugAPM.SetOnClickListener(this);
            cbEnableVideoRTPDump.SetOnClickListener(this);
            cbEnableVoiceRTPDump.SetOnClickListener(this);

            if (loopbackMode)
            {
                remoteIp        = LOOPBACK_IP;
                etRemoteIp.Text = remoteIp;
            }
            else
            {
                remoteIp        = LocalIpAddress;
                etRemoteIp.Text = remoteIp;
            }

            // Read settings to refresh each configuration
            readSettings();
        }
Example #24
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootview=(RelativeLayout)inflater.Inflate (Resource.Layout.accountedit, container, false);

            firstnameedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_firstname_edittext);
            nn_activity.SetEditTextMaximumLength (firstnameedittext,100);
            firstnameedittext.Text = nn_accountinfo.first_name;

            lasetnameedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_lastname_edittext);
            nn_activity.SetEditTextMaximumLength (lasetnameedittext,100);
            lasetnameedittext.Text= nn_accountinfo.last_name;

            birthdatebutton = (Button)rootview.FindViewById (Resource.Id.accountedit_birthday_button);
            birthdatebutton.Hint="Birthdate";
            birthdatebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };
            birthdatebutton.Text = nn_accountinfo.user_birthdate.Split ('T') [0].Replace("-","/");

            mobilephoneedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_mobilephone_edittext);
            nn_activity.SetEditTextMaximumLength (mobilephoneedittext,20);

            mobilephoneedittext.Text = nn_accountinfo.phone_mobile;

            emailedittext = (EditText)rootview.FindViewById (Resource.Id.accountedit_email_edittext);
            nn_activity.SetEditTextMaximumLength (emailedittext,60);
            emailedittext.Focusable = false;
            emailedittext.InputType = global::Android.Text.InputTypes.Null;
            emailedittext.Text = nn_accountinfo.email;

            address1edittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_address1_edittext);
            nn_activity.SetEditTextMaximumLength (address1edittext,100);
            address1edittext.Text = nn_accountinfo.mail_address_line_1;

            address2edittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_address2_edittext);
            nn_activity.SetEditTextMaximumLength (address2edittext,100);
            address2edittext.Text = nn_accountinfo.mail_address_line_2;

            countryspinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                    stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                    stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };

            provincespinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            cityedittext = (EditText)rootview.FindViewById (Resource.Id.accountedit_city_edittext);
            nn_activity.SetEditTextMaximumLength (cityedittext,50);
            cityedittext.Text = nn_accountinfo.mail_city;

            postaledittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_postal_edittext);
            nn_activity.SetEditTextMaximumLength (postaledittext,20);
            postaledittext.Text = nn_accountinfo.mail_postal;

            raffleresultspinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_raffleresult_spinner);
            resultadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();
            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };
            if (!nn_accountinfo.prefered_contact_method.Equals(null)) {
                int spinnerPosition = 0;
                for(int i=0;i< GlobalVariable.ResultAndMessageList.Count;i++){
                    if(GlobalVariable.ResultAndMessageList[i].Equals(nn_accountinfo.prefered_contact_method)){
                        spinnerPosition = i;
                    }
                }
                raffleresultspinner.SetSelection(spinnerPosition);
            }

            charitymessagespinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_marketingmessage_spinner);
            messaegadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            charitymessagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();
            charitymessagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                charitymessagespinner.Tag=e.Position;
            };
            if (!nn_accountinfo.prefered_contact_methodcharity.Equals(null)) {
                int spinnerPosition = 0;
                for(int i=0;i< GlobalVariable.ResultAndMessageList.Count;i++){
                    if(GlobalVariable.ResultAndMessageList[i].Equals(nn_accountinfo.prefered_contact_methodcharity)){
                        spinnerPosition = i;
                    }
                }
                charitymessagespinner.SetSelection(spinnerPosition);
            }

            TextView firstnamelabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_firstname_label);
            firstnamelabel.Text = EditAccountScreenData.AccountFirstNameLabel;

            TextView AccountLastNameLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_lastname_label);
            AccountLastNameLabel.Text = EditAccountScreenData.AccountLastNameLabel;

            TextView AccountMobilePhoneLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_mobilephone_label);
            AccountMobilePhoneLabel.Text = EditAccountScreenData.AccountMobilePhoneLabel;

            TextView AccountEmailLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_email_label);
            AccountEmailLabel.Text = EditAccountScreenData.AccountEmailLabel;

            TextView AccountAddress1Label=rootview.FindViewById<TextView> (Resource.Id.accountedit_address1_label);
            AccountAddress1Label.Text = EditAccountScreenData.AccountAddress1Label;

            TextView AccountAddress2Label=rootview.FindViewById<TextView> (Resource.Id.accountedit_address1_label);
            AccountAddress2Label.Text = EditAccountScreenData.AccountAddress2Label;

            TextView AccountCityLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_city_label);
            AccountCityLabel.Text = EditAccountScreenData.AccountCityLabel;

            TextView AccountPostalLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_postal_label);
            AccountPostalLabel.Text = EditAccountScreenData.AccountPostalLabel;

            // info label
            TextView basicinfo=rootview.FindViewById<TextView> (Resource.Id.accountedit_basicinfo_textview);
            basicinfo.Text = EditAccountScreenData.BasicInfoLabelText;

            TextView contactinfo=rootview.FindViewById<TextView> (Resource.Id.accountedit_contactinfo_textview);
            contactinfo.Text = EditAccountScreenData.ContactInfoLabelText;

            TextView address=rootview.FindViewById<TextView> (Resource.Id.accountedit_addressinfo_textview);
            address.Text = EditAccountScreenData.AddressInfoLabelText;

            TextView communicateraffle=rootview.FindViewById<TextView> (Resource.Id.accountedit_communicateraffle_textview);
            communicateraffle.Text = EditAccountScreenData.RaffleResultsLabelText;

            TextView receivecharity=rootview.FindViewById<TextView> (Resource.Id.accountedit_receivecharity_textview);
            receivecharity.Text = EditAccountScreenData.CharityMarketingMessagesLabelText;

            Button editaccountbutton = rootview.FindViewById<Button> (Resource.Id.accountedit_updateaccount_button);
            editaccountbutton.Text = EditAccountScreenData.UpdateBtnText;
            editaccountbutton.Click += OnUpdateAccount;

            return rootview;
        }
Example #25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.RequestFeature(WindowFeatures.NoTitle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_login);

            mActivity = this;


            /// Shared Preference manager
            mSharedPreferencesManager = UtilityDroid.GetInstance().
                                        GetSharedPreferenceManagerWithEncriptionEnabled(mActivity.ApplicationContext);


            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.btn_login);

            button.Click += Button_Click;

            CheckBox chk_show_pwd = FindViewById <CheckBox>(Resource.Id.chk_show_pwd);

            chk_show_pwd.CheckedChange += Chk_show_pwd_CheckedChange;

            edt_username      = FindViewById <EditText>(Resource.Id.edt_username);
            edt_password      = FindViewById <EditText>(Resource.Id.edt_password);
            txt_database_name = FindViewById <TextView>(Resource.Id.txt_database_name);

            chk_remember_me = FindViewById <CheckBox>(Resource.Id.chk_remember_me);
            radio_group     = FindViewById <RadioGroup>(Resource.Id.radio_group);

            radio_btn_db_demo         = FindViewById <RadioButton>(Resource.Id.radio_btn_db_demo);
            radio_btn_db_saas         = FindViewById <RadioButton>(Resource.Id.radio_btn_db_saas);
            radio_btn_db_hq           = FindViewById <RadioButton>(Resource.Id.radio_btn_db_hq);
            radio_btn_db_lucid        = FindViewById <RadioButton>(Resource.Id.radio_btn_db_lucid);
            radio_btn_db_demo.Checked = true;
            txt_database_name.Text    = GetString(Resource.String.db_demo);

            username = mSharedPreferencesManager.GetString(ConstantsDroid.USERNAME_PREFERENCE, "");
            password = mSharedPreferencesManager.GetString(ConstantsDroid.PASSWORD_PREFERENCE, "");
            string databaseName = mSharedPreferencesManager.GetString(ConstantsDroid.DATABASE_PREFERENCE, GetString(Resource.String.db_demo_connection));

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                chk_remember_me.Checked = true;
                edt_username.Text       = username;
                edt_password.Text       = password;
                if (databaseName.Equals(GetString(Resource.String.db_saas_connection)))
                {
                    radio_btn_db_saas.Checked           = true;
                    WebserviceConstants.CONNECTION_NAME = GetString(Resource.String.db_saas_connection);
                    txt_database_name.Text = "(" + GetString(Resource.String.db_saas) + ")";
                }
                else if (databaseName.Equals(GetString(Resource.String.db_demo_connection)))
                {
                    radio_btn_db_demo.Checked           = true;
                    WebserviceConstants.CONNECTION_NAME = GetString(Resource.String.db_demo_connection);
                    txt_database_name.Text = "(" + GetString(Resource.String.db_demo) + ")";
                }
                else if (databaseName.Equals(GetString(Resource.String.db_hq_connection)))
                {
                    radio_btn_db_hq.Checked             = true;
                    WebserviceConstants.CONNECTION_NAME = GetString(Resource.String.db_hq_connection);
                    txt_database_name.Text = "(" + GetString(Resource.String.db_hq) + ")";
                }
                else
                {
                    radio_btn_db_lucid.Checked          = true;
                    WebserviceConstants.CONNECTION_NAME = GetString(Resource.String.db_lucid_connection);
                    txt_database_name.Text = "(" + GetString(Resource.String.db_lucid) + ")";
                }
            }

            spin_language = FindViewById <Spinner>(Resource.Id.spin_language);


            // Set Language in spinner
            InitLanguageSpinnerValues();
            SetLanguageSpinnerAdapter();

            // Initialize listener for spinner
            InitializeListeners();


            string preferenceLang = mSharedPreferencesManager.GetString(ConstantsDroid.APP_LANG_PREFERENCE, ConstantsDroid.LANG_ENGLISH_CODE);

            spin_language.SetSelection((preferenceLang.Equals(ConstantsDroid.LANG_ENGLISH_CODE)) ? 0 : 1);
            HelpMe.SetLocale(preferenceLang, mActivity);
        }
Example #26
0
		async public Task<bool> BtnSaveClickAsync()
		{
			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return false ;

			if (Validate () == false)
				return false;

            _task.Typ = BusinessLayer.UtilityClasses.taskTyps [_spinnerTyp.SelectedItemPosition].ID;
            _task.Art = BusinessLayer.UtilityClasses.taskArts [_spinnerArt.SelectedItemPosition].ID;

			// First test if the task is going to be closed
            if (_task.Status == "0" && _taskStatus[ _spinnerStatus.SelectedItemPosition].StartsWith("1") == true)
			{
				// Because the task is been closed, we have to enter the following values
				_task.User_Close =MainActivity.User.Name;
				_task.Datum_Close =  DateTime.Now.ToString ("dd.MM.yyyy");
				_task.Time_Close = 	 DateTime.Now.Hour.ToString ("00") + ":" + DateTime.Now.Minute.ToString ("00");

			}
            else if(_task.ID == null && _taskStatus[_spinnerStatus.SelectedItemPosition].StartsWith("1") == true)
			{
				// Because the task is been closed, we have to enter the following values
				_task.User_Close =MainActivity.User.Name;
				_task.Datum_Close =  DateTime.Now.ToString ("dd.MM.yyyy");
				_task.Time_Close = 	 DateTime.Now.Hour.ToString ("00") + ":" + DateTime.Now.Minute.ToString ("00");
			}
			else
			{
				_task.User_Close = "";
				_task.Datum_Close = "";
				_task.Time_Close = "00:00:00,00";
			}

			_task.Status = _taskStatus[ _spinnerStatus.SelectedItemPosition].Substring(0,1);

			if (_ansprechpartner != null)
				_task.AnsprechpartnerID = _ansprechpartner.ID;
			else
				_task.AnsprechpartnerID = "0";

			_task.Adr_Id =  _stateClass._person.ID;
			_task.Datum = _edDatum.Text;
			_task.Zeit = _edZeit.Text;
            _task.Mitarbeiter = BusinessLayer.UtilityClasses.mitarbeitern[ _spinnerMitarbeiter.SelectedItemPosition].Name;
            _task.Abteilung = BusinessLayer.UtilityClasses.abteilungen[ _spinnerAbteilung.SelectedItemPosition].Name;
			_task.Ansprechpartner = _edAnsprechpartner.Text;//_ansprechpartnern[ _spinnerAnsprechpartner.SelectedItemPosition].Name; 
			_task.Memo = _edText.Text;
			_task.Datum_Save = _edDatumEdit.Text;
			_task.User_Save =MainActivity.User.Name;
			_task.Time_TelStart = _edStartTelefon.Text;
			_task.Time_TelDauer = _edDauerTelefon.Text;

			if (string.IsNullOrEmpty ( _task.ID) )
				_task.Datum_Edit = DateTime.Now.ToString ("dd.MM.yyyy");

			if (_task.ID == null)
			{
				// INSERT statement
                // if we are working with the Offline Database, we have to create a custom ID
                if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                    // "OF" for Offline + Date + Time
                    _task.ID = "OF" + DateTime.Now.ToString("dd.MM.yyyy") + DateTime.Now.ToString("hh:mm:ss");

                var result = await _task.SaveAsync(MainActivity.User);
                if ( result ==  DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected) 
  					return false;

				_tasks.Insert (0, _task);
				_edNummer.Text = _task.ID;

				// Redraw the spinner
				_spinnerTask = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
				_spinnerTask.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerTaskItemSelected );
				TaskViewAdapter _adapterTask = new TaskViewAdapter (_mainActivity,_tasks);
				_spinnerTask.Adapter = _adapterTask;

			}
			else
			{
				// UPDATE statement
                var result = await _task.SaveAsync(MainActivity.User);
                if ( result ==  DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected) 
					return false;

				// Redraw the spinner
				_spinnerTask = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
				_spinnerTask.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerTaskItemSelected );
				TaskViewAdapter _adapterTask = new TaskViewAdapter (_mainActivity,_tasks);
				_spinnerTask.Adapter = _adapterTask;
				_spinnerTask.SetSelection (_selectedIndex);
			}

			// Disable the controls
			DisableControls ();

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(permission.Create, permission.Update, false, false, false);
            else
                ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);

			DataAccessLayer.PerformanceWatch stopWatch = new DataAccessLayer.PerformanceWatch();

			return true;
		}
Example #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.AddLaborPopUpLayout);
            SetCancelable (true);

            var cancel = (Button)FindViewById (Resource.Id.cancelAddLabor);
            cancel.Click += (sender, e) => Dismiss ();

            delete = (Button)FindViewById (Resource.Id.deleteAddLabor);
            delete.Enabled = !Assignment.IsHistory;
            delete.Click += (sender, e) => {
                //delete & reload
                if (CurrentLabor != null && CurrentLabor.Id != -1)
                    DeleteLabor ();
                else
                    Dismiss ();
            };

            var save = (Button)FindViewById (Resource.Id.saveAddLabor);
            save.Enabled = !Assignment.IsHistory;
            save.Click += (sender, e) => SaveLabor ();

            var addHours = (ImageButton)FindViewById (Resource.Id.addLaborHours);
            addHours.Enabled = !Assignment.IsHistory;
            addHours.Click += (sender, e) => {
                //add to the hours
                double total = hours.Text.ToDouble (CultureInfo.InvariantCulture);
                total += .5;
                CurrentLabor.Hours = TimeSpan.FromHours (total);
                hours.Text = total.ToString ("0.0");
            };

            var subtractHours = (ImageButton)FindViewById (Resource.Id.subtractLaborHours);
            subtractHours.Enabled = !Assignment.IsHistory;
            subtractHours.Click += (sender, e) => {
                //subtract the hours
                double total = hours.Text.ToDouble (CultureInfo.InvariantCulture);
                total -= .5;
                total = total < 0.0 ? 0.0 : total;
                CurrentLabor.Hours = TimeSpan.FromHours (total);
                hours.Text = total.ToString ("0.0");
            };

            type = (Spinner)FindViewById (Resource.Id.addLaborHoursType);
            type.Enabled = !Assignment.IsHistory;
            description = (EditText)FindViewById (Resource.Id.addLaborDescription);
            description.Enabled = !Assignment.IsHistory;
            hours = (TextView)FindViewById (Resource.Id.addLaborHoursText);
            hours.Enabled = !Assignment.IsHistory;

            var adapter = new LaborTypeSpinnerAdapter (laborTypes, Context, Resource.Layout.SimpleSpinnerItem);
            adapter.TextColor = Color.Black;
            type.Adapter = adapter;

            if (CurrentLabor != null)
                type.SetSelection (laborTypes.ToList ().IndexOf (CurrentLabor.Type));

            type.ItemSelected += (sender, e) => {
                var laborType = laborTypes [e.Position];
                if (CurrentLabor.Type != laborType)
                    CurrentLabor.Type = laborType;
            };
        }
Example #28
0
 void SetupClassSpinner(View view)
 {
     spinItem = view.FindViewById<Spinner> (Resource.Id.txtClass);
     dAdapterItem = new ArrayAdapter<String> (this.Activity, Resource.Layout.spinner_item, classcodes);
     dAdapterItem.SetDropDownViewResource (Resource.Layout.SimpleSpinnerDropDownItemEx);
     spinItem.Adapter = dAdapterItem;
     spinItem.ItemSelected+= SpinItem_ItemSelected;
     string selectclass = ((GlobalvarsApp)Application.Context).ITEMCLASS;
     if (!string.IsNullOrEmpty (selectclass)) {
         int pos = dAdapterItem.GetPosition (selectclass);
         if (pos>-1)
             spinItem.SetSelection (pos);
     }
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment

            studentID = Arguments.GetString ("studentID");

            View view = inflater.Inflate(Resource.Layout.ProfilePageLayout, container, false);
            profileIdInput = view.FindViewById<TextView>(Resource.Id.profileIdInput);
            profileNameInput = view.FindViewById<EditText>(Resource.Id.profileNameInput);
            profileNationalityInput = view.FindViewById<EditText>(Resource.Id.profileNationalityInput);
            profileYearInput = view.FindViewById<EditText>(Resource.Id.profileYearInput);
            profileContactNumberInput = view.FindViewById<EditText>(Resource.Id.profileContactInput);
            profileFieldOfStudyInput = view.FindViewById<Spinner>(Resource.Id.profileFieldOfStudyInput);
            profileInterestInput = view.FindViewById<Spinner>(Resource.Id.profileInterestInput);
            profileEditButton = view.FindViewById<Button> (Resource.Id.profileEditButton);

            profileFieldOfStudyInput.Enabled = false;
            profileInterestInput.Enabled = false;

            string path = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
            accountDB = new SQLiteConnection (System.IO.Path.Combine(path, "Database.db"));
            prof = accountDB.Query<Profile>("SELECT * FROM Profile WHERE StudentID = '" + studentID + "'");

            profileIdInput.Text = prof[0].StudentID;
            profileNameInput.Text = prof[0].StudentName;
            profileNationalityInput.Text = prof[0].Nationality;
            profileContactNumberInput.Text = prof[0].ContactNumber;
            for (int i = 0; i<DataList.fields.Length; i++)
            {
                if(DataList.fields[i].Equals(prof [0].Degree))
                    profileFieldOfStudyInput.SetSelection(i);
            }
            for (int i = 0; i<DataList.interests.Length; i++)
            {
                if(DataList.interests[i].Equals(prof [0].Interest))
                    profileInterestInput.SetSelection(i);
            }
            profileYearInput.Text = prof [0].Year;

            profileEditButton.Click += (sender, e) => {
                switch(mode)
                {
                case "Confirmed":
                    mode = "Edittable";
                    changeEdittable(true);
                    profileEditButton.Text = "Confirm";
                    break;
                case "Edittable":
                    mode = "Confirmed";
                    changeEdittable(false);
                    profileEditButton.Text = "Edit";
                    accountDB.Query<Profile>("UPDATE Profile SET StudentName = '" + profileNameInput.Text + "' WHERE StudentID = '" + studentID + "'");
                    accountDB.Query<Profile>("UPDATE Profile SET Nationality = '" + profileNationalityInput.Text + "' WHERE StudentID = '" + studentID + "'");
                    accountDB.Query<Profile>("UPDATE Profile SET ContactNumber = '" + profileContactNumberInput.Text + "' WHERE StudentID = '" + studentID + "'");
                    accountDB.Query<Profile>("UPDATE Profile SET Year = '" + profileYearInput.Text + "' WHERE StudentID = '" + studentID + "'");
                    accountDB.Query<Profile>("UPDATE Profile SET Degree = '" + profileFieldOfStudyInput.SelectedItem.ToString() + "' WHERE StudentID = '" + studentID + "'");
                    accountDB.Query<Profile>("UPDATE Profile SET Interest = '" + profileInterestInput.SelectedItem.ToString() + "' WHERE StudentID = '" + studentID + "'");

                    break;
                }

            };
            return view;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false);

            text = rootView.FindViewById<TextView> (Resource.Id.largeText);

            user = Common.GetCurrentUser ();

            if (user == null) {
                text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ";
                text.SetTextAppearance (Activity, Resource.Style.text_danger);

                miAddAtt.SetEnabled (false);
                return rootView;
            }

            merchant = Common.GetMerchant (user.username);

            currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20);

            infos = Common.GetInfos (user.username);

            drugs = Common.GetDrugs (user.username);

            table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent);

            spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner);

            ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies));

            spnSelectedPharmacy.Adapter = adapter;

            spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                selectedPharmacy = currentPharmacies [e.Position].id;

                currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy);

                RefreshTable();
            };

            spnSelectedPharmacy.SetSelection (0);

            //			RefreshTable ();

            return rootView;
            //return base.OnCreateView (inflater, container, savedInstanceState);
        }
Example #31
0
		async public Task<bool> BtnSaveClickAsync ()
		{

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return false ;

			if (Validate () == false)
				return false;

            int selectedIndex;
			_ansprechpartner.Vorname = _edVorname.Text;
			_ansprechpartner.IDParent = _stateClass._person.ID;
			_ansprechpartner.Name = _edName.Text;
			_ansprechpartner.Nummer = _edNummer.Text;
			_ansprechpartner.Strasse = _edStrasse.Text;
			_ansprechpartner.PLZ = _edPLZ.Text;
			_ansprechpartner.Ort = _edOrt.Text;
            _ansprechpartner.LandNummer = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].Nummer;
            if (Utilities.GetCurrentLanguage(_mainActivity) == "DE")
                _ansprechpartner.Land = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].NameGerman;
            else
                _ansprechpartner.Land = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].NameEnglish;
            _ansprechpartner.Telefon = _edTelefon.Text;
			_ansprechpartner.Email = _edEmail.Text;

			if (_ansprechpartner.ID == null)
			{
				// INSERT statement
                var result = await _ansprechpartner.SaveAsync(MainActivity.User);
                if ( result ==  DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected) 
					return false;
				_ansprechpartnern.Add (_ansprechpartner);
				_edNummer.Text = _ansprechpartner.Nummer;
                selectedIndex = _ansprechpartnern.Count - 1;
                _tvEmail.Text = _ansprechpartner.Email;
                _tvPhone.Text = _ansprechpartner.Telefon;

			}
			else
			{
				// UPDATE statement
                var result = await _ansprechpartner.SaveAsync(MainActivity.User);
                if ( result ==  DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected) 
					return false;
                selectedIndex = _selectedIndex;
                _tvEmail.Text = _ansprechpartner.Email;
                _tvPhone.Text = _ansprechpartner.Telefon;
            }

			// Disable the controls
			DisableControls ();

			// Set the status of the buttons
			_mainActivity._btnSave.Enabled = false;

			// Redraw the spinner
			_spinnerAnsprechpartner = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
			_spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerItemSelected);
			AnsprechpartnerViewAdapter _adapter = new AnsprechpartnerViewAdapter (_mainActivity, _ansprechpartnern);
			_spinnerAnsprechpartner.Adapter = _adapter;
            _spinnerAnsprechpartner.SetSelection(selectedIndex);

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(false, false, false, false, false);
            else
                ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);

            return true;
		}
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            user = Common.GetCurrentUser ();
            merchant = Common.GetMerchant (user.username);
            //			currentRout = GetRout ();
            //			int[] ids = {1,2,3,4,5};
            //			currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (ids);

            currentPharmacies = (List<Pharmacy>)PharmacyManager.GetPharmacies (string.Empty, 20);

            infos = Common.GetInfos (user.username);

            //			infos = new List<Info>();
            //			infos.Add (new Info {id = 2, name = @"Кол-во" });
            //			infos.Add (new Info {id = 4, name = @"Розница" });
            //			infos.Add (new Info {id = 6, name = @"Заказано" });

            drugs = Common.GetDrugs (user.username);

            //			AttendanceResultManager.DeleteAttendanceResult (1);
            ////			var att = new Attendance (1, new DateTime (2015, 10, 28), infos, drugs, @"N");
            //			var att = new Attendance() { id = 1, date = new DateTime (2015, 10, 28), pharmacy = 1 };
            //			AttendanceManager.SaveAttendance (att);
            //
            //			var res = AttendanceResultManager.GenerateResults(infos, drugs, @"N");
            //			AttendanceResultManager.SaveNewAttendanceResults (att.id, res);

            View rootView = inflater.Inflate(Resource.Layout.MainFragment, container, false);

            text = rootView.FindViewById<TextView> (Resource.Id.largeText);
            text.Text = @"НЕТ ПРЕПАРАТОВ ИЛИ СОБИРАЕМОЙ ИНФОРМАЦИИ";
            text.SetTextAppearance (Activity, Resource.Style.text_danger);

            table = rootView.FindViewById<TableLayout> (Resource.Id.mfFullContent);

            spnSelectedPharmacy = rootView.FindViewById<Spinner> (Resource.Id.mfSelectedPharmacySpinner);

            ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, PharmacyManager.ToArray (currentPharmacies));

            spnSelectedPharmacy.Adapter = adapter;

            spnSelectedPharmacy.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                selectedPharmacy = currentPharmacies [e.Position].id;

                currentAttendances = (List<Attendance>)AttendanceManager.GetAttendances (selectedPharmacy);

                RefreshTable();
            };

            spnSelectedPharmacy.SetSelection (0);

            //			RefreshTable ();

            return rootView;
            //return base.OnCreateView (inflater, container, savedInstanceState);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AppContextLiveData.Instance.SetLocale(this);

            if (AppContextLiveData.Instance.IsPortrait)
            {
                SetContentView(Resource.Layout.SettingsActivityPortrait);
            }
            else
            {
                SetContentView(Resource.Layout.SettingsActivityLandscape);
            }

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

            SetActionBar(toolbar);

            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(true);
            ActionBar.SetTitle(Resource.String.SettingsActivity);

            _spinnerLanguages       = FindViewById <Spinner>(Resource.Id.spinnerLanguage);
            _spinnerPhotoResolution = FindViewById <Spinner>(Resource.Id.spinnerResolution);

            _switchManualViewAngle = FindViewById <Switch>(Resource.Id.switchManualViewAngle);
            _seekBarCorrectionViewAngleHorizontal = FindViewById <SeekBar>(Resource.Id.seekBarCorrectionViewAngleHorizontal);
            _textViewAngleHorizontal            = FindViewById <TextView>(Resource.Id.textViewAngleHorizontal);
            _seekBarCorrectionViewAngleVertical = FindViewById <SeekBar>(Resource.Id.seekBarCorrectionViewAngleVertical);
            _textViewAngleVertical = FindViewById <TextView>(Resource.Id.textViewAngleVertical);
            _resetButton           = FindViewById <Button>(Resource.Id.reset);
            _resetButton.SetOnClickListener(this);

            var adapterLanguages = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, _listOfLanguages);

            _spinnerLanguages.Adapter = adapterLanguages;
            _spinnerLanguages.SetSelection(_listOfLanguages.FindIndex(i => i == PoiCountryHelper.GetLanguageName(_settings.Language)));
            _spinnerLanguages.ItemSelected += (sender, args) => { InvalidateOptionsMenu(); };

            _listOfCameraResolutions = CameraUtilities.GetCameraResolutions(_settings.CameraId).Where(x => x.Width >= ScaleImageView.MIN_IMAGE_SIZE && x.Height >= ScaleImageView.MIN_IMAGE_SIZE).ToList();
            var adapterPhotoResolution = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, _listOfCameraResolutions);

            _spinnerPhotoResolution.Adapter = adapterPhotoResolution;
            var resolutionIdx = _listOfCameraResolutions.FindIndex(i => i.Equals(_settings.CameraResolutionSelected));

            _spinnerPhotoResolution.SetSelection(resolutionIdx);
            _spinnerPhotoResolution.ItemSelected += (sender, args) => { InvalidateOptionsMenu(); };

            _switchManualViewAngle.Checked = _settings.IsViewAngleCorrection;
            _switchManualViewAngle.SetOnClickListener(this);

            _seekBarCorrectionViewAngleHorizontal.Enabled          = _settings.IsViewAngleCorrection;
            _seekBarCorrectionViewAngleHorizontal.Progress         = (int)(_settings.CorrectionViewAngleHorizontal * 10);
            _seekBarCorrectionViewAngleHorizontal.ProgressChanged += SeekBarProgressChanged;

            _seekBarCorrectionViewAngleVertical.Enabled          = _settings.IsViewAngleCorrection;
            _seekBarCorrectionViewAngleVertical.Progress         = (int)(_settings.CorrectionViewAngleVertical * 10);
            _seekBarCorrectionViewAngleVertical.ProgressChanged += SeekBarProgressChanged;

            UpdateViewAngleText(_settings.CorrectionViewAngleHorizontal, _settings.CorrectionViewAngleVertical);

            _switchManualGpsLocation         = FindViewById <Switch>(Resource.Id.switchManualGpsLocation);
            _switchManualGpsLocation.Checked = _settings.IsManualLocation;
            _switchManualGpsLocation.SetOnClickListener(this);

            _textViewLatitude               = FindViewById <TextView>(Resource.Id.latitudeTitle);
            _textViewLongitude              = FindViewById <TextView>(Resource.Id.longitudeTitle);
            _textViewAltitude               = FindViewById <TextView>(Resource.Id.altitudeTitle);
            _editTextLatitude               = FindViewById <EditText>(Resource.Id.editTextLatitude);
            _editTextLongitude              = FindViewById <EditText>(Resource.Id.editTextLongitude);
            _editTextAltitude               = FindViewById <EditText>(Resource.Id.editTextAltitude);
            _editTextLatitude.TextChanged  += ManualGpsLocationChanged;
            _editTextLongitude.TextChanged += ManualGpsLocationChanged;
            _editTextAltitude.TextChanged  += ManualGpsLocationChanged;

            EnableOrDisableGpsLocationInputs(_settings.IsManualLocation);
            InitializeGpsLocationInputs(_settings.IsManualLocation ? _settings.ManualLocation : AppContextLiveData.Instance.MyLocation);

            _switchAltitudeFromElevationMap         = FindViewById <Switch>(Resource.Id.switchAltitudeFromElevationMap);
            _switchAltitudeFromElevationMap.Checked = _settings.AltitudeFromElevationMap;
            _switchAltitudeFromElevationMap.SetOnClickListener(this);

            _switchAutoElevationProfile         = FindViewById <Switch>(Resource.Id.switchAutoElevationProfile);
            _switchAutoElevationProfile.Checked = _settings.AutoElevationProfile;
            _switchAutoElevationProfile.SetOnClickListener(this);

            var buttonClearElevationData = FindViewById <Button>(Resource.Id.buttonClearElevationData);

            buttonClearElevationData.SetOnClickListener(this);

            _textViewElevationDataSize = FindViewById <TextView>(Resource.Id.textViewElevationDataSize);

            UpdateElevationDataSize();
        }
Example #34
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
			mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.myDrawer);
			progressBar = FindViewById<ProgressBar> (Resource.Id.loadingProgressBar);
			leftDrawerLinearLayoutId = (LinearLayout)FindViewById (Resource.Id.left_drawer);
			azureAdap = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1);
		
			//Start Expandable
			mListExView = FindViewById<ExpandableListView> (Resource.Id.expandListView);

			tempListView = FindViewById<ListView> (Resource.Id.lstViewTemp);
			//setMasterParent ();
			//setChild ();

			adapter = new myListViewAdap (NewParentItems);
			adapter.setInflater ((LayoutInflater)GetSystemService (Context.LayoutInflaterService), this);
			mListExView.SetAdapter (adapter);
			//End Expandable

			mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, Resource.Drawable.ic_navigation_drawer, Resource.String.open_drawer, Resource.String.close_drawer);


			mDrawerLayout.SetDrawerListener (mDrawerToggle);
			ActionBar.SetDisplayHomeAsUpEnabled (true);
			ActionBar.SetHomeButtonEnabled (true);
			ActionBar.SetDisplayShowTitleEnabled (true);
           
			//Declaration of Image button and other buttons
			ImageButton imgBtnPlus = (ImageButton)FindViewById (Resource.Id.buttonNewPanel);  
			Button btnCancel = (Button)FindViewById (Resource.Id.CancelPanel);
			Button btnSavePanel = (Button)FindViewById (Resource.Id.SavePanel);
			TableRow tRowSaveCancel = (TableRow)FindViewById (Resource.Id.tRowSaveCancel);    //Row of save Button
			EditText txtidofNewPanel = (EditText)(FindViewById (Resource.Id.txtOfNewPanel));
			spinMasterPanel = FindViewById<Spinner> (Resource.Id.spinnerExistingMasterPanel);


			//Code to add default value in the spinner
			First = new List<string> ();
			First.Add ("Select Parent Panel");
			spinnerArrayAdapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerItem, First);
			spinnerArrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			spinMasterPanel.Adapter = spinnerArrayAdapter;
			//End


			appendSpinner (spinMasterPanel, parentItems, spinnerArrayAdapter, First); //Calling spinner to append more parent.



			imgBtnPlus.Click += (object sender, EventArgs e) => {
				if (SetTag == 1) {
					imgBtnPlus.SetImageResource (Resource.Drawable.Multsign);
					txtidofNewPanel.Visibility = ViewStates.Visible;
					tRowSaveCancel.Visibility = ViewStates.Visible;
					spinMasterPanel.Visibility = ViewStates.Visible;
					SetTag = 0;

				} else if (SetTag == 0) {
					imgBtnPlus.SetImageResource (Resource.Drawable.plussign);

					txtidofNewPanel.Visibility = ViewStates.Gone;
					tRowSaveCancel.Visibility = ViewStates.Gone;
					spinMasterPanel.Visibility = ViewStates.Gone;
					SetTag = 1;
				}
			};

			btnCancel.Click += delegate {

				imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
				tRowSaveCancel.Visibility = ViewStates.Gone;
				txtidofNewPanel.Visibility = ViewStates.Gone;
				spinMasterPanel.Visibility = ViewStates.Gone;

			};


			#region SavePanelCLickActivity

			btnSavePanel.Click += (object sender, EventArgs e) => {
				
				imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
				tRowSaveCancel.Visibility = ViewStates.Gone;
				txtidofNewPanel.Visibility = ViewStates.Gone;
				spinMasterPanel.Visibility = ViewStates.Gone;
				string newPanelText = txtidofNewPanel.Text.Trim ();

				if (newPanelText != "") {
					string spinnerItem = spinMasterPanel.SelectedItem.ToString ();   // Selected item in the spinner

					if (spinnerItem != "Select Parent Panel") {
						child = new List<string> ();
						child.Add (newPanelText);

						if (NewParentItems.ContainsKey (spinnerItem)) {
							NewParentItems [spinnerItem].AddRange (child);
							dictPanelItemsForMail [spinnerItem].AddRange (child);
							
						} else {
                            
							NewParentItems [spinnerItem] = child;
							dictPanelItemsForMail [spinnerItem] = child;

						}


					} else {
						
						child = new List<string> ();
						NewParentItems [newPanelText] = child;
						dictPanelItemsForMail [newPanelText] = child;
						appendSpinner (spinMasterPanel, newListForSpin, spinnerArrayAdapter, First);
					}

					child = new List<string> ();
					childItems.Add (child);
					myListViewAdap adapterNew = new myListViewAdap (NewParentItems);
					adapterNew.setInflater ((LayoutInflater)GetSystemService (Context.LayoutInflaterService), this);
					mListExView.SetAdapter (adapter);									//Inflate Expandable Adapter
							
					txtidofNewPanel.Text = "";
					InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
					inputmanager.HideSoftInputFromWindow (txtidofNewPanel.WindowToken, HideSoftInputFlags.None);		// To hide the keyboard

					spinMasterPanel.SetSelection (0, true);
				}
			};

			#endregion SavePanelActivityEnd


			// Code to hide keyboard on spinner touch
			spinMasterPanel.Touch += (object sender, View.TouchEventArgs e) => {

				InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
				inputmanager.HideSoftInputFromWindow (spinMasterPanel.WindowToken, HideSoftInputFlags.None);	
				spinMasterPanel.PerformClick ();
			};


			// code to handle ChildClick Event
			mListExView.ChildClick += mListExView_ChildClick;

			connectMaster (1);
	
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_load_animation);

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

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.loadAnimation);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widgets
            mChart                = (FlexChart)FindViewById(Resource.Id.flexchart);
            mChartTypeSpinner     = (Spinner)FindViewById(Resource.Id.chartTypeSpinner);
            mStackingSpinner      = (Spinner)FindViewById(Resource.Id.stackingSpinner);
            mAnimationModeSpinner = (Spinner)FindViewById(Resource.Id.animationModeSpinner);
            mRotatedSwitch        = (Switch)FindViewById(Resource.Id.rotatedSwitch);

            // set the binding for X-axis of FlexChart


            // setting the source of data/items in FlexChart
            dataSource = ChartPoint.GetList();

            Chartinitialization.InitialDefaultChart(mChart, dataSource);

            C1Animation loadAnimation = new C1Animation();

            loadAnimation.Duration = new TimeSpan(1500 * 10000);
            loadAnimation.Easing   = new Android.Views.Animations.AccelerateInterpolator();
            mChart.LoadAnimation   = loadAnimation;

            ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartTypeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mChartTypeSpinner.Adapter       = adapter1;
            mChartTypeSpinner.ItemSelected += MChartTypeSpinner_ItemSelected;

            // create custom adapter for second spinner and initialize with string
            // array
            ArrayAdapter adapter2 = ArrayAdapter.CreateFromResource(this, Resource.Array.stackingSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mStackingSpinner.Adapter       = adapter2;
            mStackingSpinner.ItemSelected += MStackingSpinner_ItemSelected;

            ArrayAdapter animationModeAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.animationModeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mAnimationModeSpinner.Adapter = animationModeAdapter;
            mAnimationModeSpinner.SetSelection(1);
            mAnimationModeSpinner.ItemSelected += MAnimationModeSpinner_ItemSelected;

            mRotatedSwitch.CheckedChange += MRotatedSwitch_CheckedChange;


            mChart.SelectionMode  = ChartSelectionModeType.Point;
            mChart.SelectionStyle = new ChartStyle();
            mChart.SelectionStyle.StrokeDashArray = new double[] { 10, 10 };

            mChart.SelectionStyle.Stroke          = Color.Red;
            mChart.SelectionStyle.StrokeThickness = 3;

            //  mChart.SetBackgroundColor(Color.Gray);
        }
Example #36
0
        private void LoadData()
        {
            TextView txtprinter = FindViewById <TextView> (Resource.Id.txtad_printer);

            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            AdPara apra = new AdPara();

            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var list = db.Table <AdPara> ().ToList <AdPara> ();
                if (list.Count > 0)
                {
                    apra = list [0];
                    string[] prefixs = apra.Prefix.Split(new char[] { '|' });
                    txtInvPrefix.Text = prefixs[0];
                    if (prefixs.Length > 1)
                    {
                        txtCashPrefix.Text = prefixs [1];
                    }
                    else
                    {
                        txtCashPrefix.Text = prefixs [0];
                    }
                    if (rights.IsSOModule)
                    {
                        txtSOPrefix.Text = apra.SOPrefix;
                    }
                    if (rights.IsCNModule)
                    {
                        txtCNPrefix.Text = apra.CNPrefix;
                    }
                    if (rights.IsDOModule)
                    {
                        txtDOPrefix.Text = apra.DOPrefix;
                    }
                    txtprinter.Text = apra.PrinterName;
                    int ptypepos = adapterPT.GetPosition(apra.PrinterType);                       //to store printer type
                    spinPrType.SetSelection(ptypepos);
                    txtPrinterIP.Text = (string.IsNullOrEmpty(apra.PrinterIP))?"192.168.1.244":apra.PrinterIP;

                    int prnpos = adapterBT.GetPosition(apra.PrinterName);
                    if (prnpos > 0)
                    {
                        spinBt.SetSelection(prnpos);
                    }
                    int position = adapter.GetPosition(apra.PaperSize);
                    if (position > 0)
                    {
                        spinner.SetSelection(position);
                    }
                    else
                    {
                        spinner.SetSelection(0);
                    }
                }
                else
                {
                    txtprinter.Text   = "PT-II";
                    txtPrinterIP.Text = "192.168.1.244";
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                if (savedInstanceState != null)
                {
                    _firstTimeView    = savedInstanceState.GetBoolean("firstTimeView");
                    _relationshipsID  = savedInstanceState.GetInt("relationshipsID");
                    _dialogTitle      = savedInstanceState.GetString("dialogTitle");
                    _currentSpeakType = savedInstanceState.GetInt("currentSpeakType");
                }
                if (Intent != null)
                {
                    _relationshipsID = Intent.GetIntExtra("relationshipsID", -1);
                    _dialogTitle     = Intent.GetStringExtra("activityTitle");
                }

                SetContentView(Resource.Layout.StructuredPlanRelationshipsDialogActivityLayout);

                GetFieldComponents();
                CheckMicPermission();

                _toolbar = ToolbarHelper.SetupToolbar(this, Resource.Id.structuredplanrelationshipsdialogactivitylayoutToolbar, Resource.String.StructuredPlanRelationshipsActivityTitle, Color.White);

                _imageLoader = ImageLoader.Instance;

                _imageLoader.LoadImage
                (
                    "drawable://" + Resource.Drawable.structuredplanrelationshipspager,
                    new ImageLoadingListener
                    (
                        loadingComplete: (imageUri, view, loadedImage) =>
                {
                    var args = new LoadingCompleteEventArgs(imageUri, view, loadedImage);
                    ImageLoader_LoadingComplete(null, args);
                }
                    )
                );

                SetupCallbacks();

                GetRelationshipsData();

                SetupSpinners();

                if (_relationshipsID != -1 && _relationships != null)
                {
                    if (_firstTimeView)
                    {
                        //existing item
                        if (_withWhom != null)
                        {
                            _withWhom.Text = _relationships.WithWhom.Trim();
                        }
                        if (_type != null)
                        {
                            _type.SetSelection((int)_relationships.Type);
                        }
                        if (_strength != null)
                        {
                            _strength.Progress = _relationships.Strength;
                        }
                        if (_feeling != null)
                        {
                            _feeling.SetSelection(_relationships.Feeling);
                        }
                        if (_action != null)
                        {
                            _action.SetSelection((int)_relationships.Action);
                        }
                        if (_actionOf != null)
                        {
                            _actionOf.Text = _relationships.ActionOf.Trim();
                        }
                        _firstTimeView = false;
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreateView: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorStructuredPlanRelationshipsDialogCreateView), "StructuredPlanRelationshipsDialogActivity.OnCreateView");
                }
            }
        }
Example #38
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.activity_inventario);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar1);

            SetActionBar(toolbar);
            ActionBar.Title = "Inventario";

            //Cargar proveedor  en spinner
            var           Proveedores = adoInventario.AdoSelectProveedores();
            Spinner       spinner     = FindViewById <Spinner>(Resource.Id.spinner);
            List <string> Proveedor   = new List <string>();

            foreach (var item in Proveedores)
            {
                var resl = item;
                Proveedor.Add(resl);
            }
            var adapter = new ArrayAdapter <string>(this,
                                                    Android.Resource.Layout.SimpleSpinnerItem, Proveedor);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            var recibir = Intent;

            ProductoModificar = recibir.GetStringExtra("Item");
            if (ProductoModificar != null)
            {
                Guardar  = false;
                Producto = ProductoModificar.Split("-");
                EditText editText_Item = FindViewById <EditText>(Resource.Id.editText_Item);
                editText_Item.Text    = Producto[0];
                editText_Item.Enabled = false;
                EditText editText_Nombre = FindViewById <EditText>(Resource.Id.editText_Nombre);
                editText_Nombre.Text   = Producto[1];
                adoInventario.Producto = Producto[0].Trim();
                var      Productoss          = adoInventario.AdoSelectIDTodos();
                string   Cli                 = Productoss[0];
                string[] Cli2                = Cli.Split("--");
                EditText editText_Referencia = FindViewById <EditText>(Resource.Id.editText_Referencia);
                editText_Referencia.Text = Cli2[2];
                EditText editText_iva = FindViewById <EditText>(Resource.Id.editText_iva);
                editText_iva.Text = Cli2[3];
                int    IdSeleccionProveedor = 0;
                string Seleccion            = "";
                for (int i = 0; i < spinner.Count; i++)
                {
                    spinner.SetSelection(i);
                    Seleccion = spinner.SelectedItem.ToString().Substring(0, 1);
                    if (Seleccion == Cli2[4].Trim().Substring(0, 1))
                    {
                        IdSeleccionProveedor = Convert.ToInt32(Seleccion);
                    }
                }
                spinner.SetSelection(IdSeleccionProveedor);
                EditText editText_costo = FindViewById <EditText>(Resource.Id.editText_costo);
                editText_costo.Text = Cli2[5];
                EditText editText_PrecioVenta = FindViewById <EditText>(Resource.Id.editText_PrecioVenta);
                editText_PrecioVenta.Text = Cli2[6];
            }

            RadioButton radioButtonEntrada = FindViewById <RadioButton>(Resource.Id.rb_entradas);

            radioButtonEntrada.Checked = true;
            RadioButton radioButtonSalida = FindViewById <RadioButton>(Resource.Id.rb_Salidas);

            //Cargar maximo Item

            if (Guardar == true)
            {
                var      Productos = adoInventario.AdoSelectMaxItem();
                EditText editText  = FindViewById <EditText>(Resource.Id.editText_Item);

                if (Productos[0] != "")
                {
                    var ItemMax = Convert.ToDouble(Productos[0]) + 1;
                    editText.Text = ItemMax.ToString();
                }
                else
                {
                    editText.Text = "1";
                }
            }

            //Button btnSalir = FindViewById<Button>(Resource.Id.btn_salir);
            //btnSalir.Click += (sender, e) =>
            //{
            //    var intent = new Intent(this, typeof(MainActivity));
            //    StartActivity(intent);
            //};

            radioButtonEntrada.Click += (sender, e) =>
            {
                radioButtonSalida.Checked = false;
            };
            radioButtonSalida.Click += (sender, e) =>
            {
                radioButtonEntrada.Checked = false;
            };

            //btnGuardar.Click += (sender, e) =>
            //{
            //};
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.potvrda_page1);
            Android.Widget.Toolbar toolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbarHomePage);
            opisRadaInput      = FindViewById <EditText>(Resource.Id.opisRadaInput);
            godinaInput        = FindViewById <EditText>(Resource.Id.godinaInput);
            potvrdaBrInput     = FindViewById <EditText>(Resource.Id.potvrdaBrInput);
            opisRadaInput      = FindViewById <EditText>(Resource.Id.opisRadaInput);
            spinnerInfestacija = FindViewById <Spinner>(Resource.Id.spinnerInfestacija);
            message            = FindViewById <TextView>(Resource.Id.message);
            datePicker         = FindViewById <DatePicker>(Resource.Id.datePicker);
            brojObjekata1Input = FindViewById <EditText>(Resource.Id.brojObjekata1Input);
            brojObjekata2Input = FindViewById <EditText>(Resource.Id.brojObjekata2Input);
            tipObjekta1        = FindViewById <LinearLayout>(Resource.Id.tipObjekta1);
            tipObjekta2        = FindViewById <LinearLayout>(Resource.Id.tipObjekta2);

            SetActionBar(toolbar);
            ActionBar.Title = "Potvrda";
            odabraniDatum   = DateTime.Now.Date;
            datePicker.UpdateDate(odabraniDatum.Year, odabraniDatum.Month - 1, odabraniDatum.Day);
            godinaInput.Text            = "2021";
            brojObjekata1Input.Text     = "1";
            brojObjekata2Input.Text     = "1";
            potvrdaBrInput.TextChanged += PotvrdaBroj_TextChanged;
            godinaInput.TextChanged    += PotvrdaGodina_TextChanged;
            godinaInput.KeyPress       += GodinaInput_KeyPress;
            potvrdaBrInput.KeyPress    += PotvrdaBrInput_KeyPress;
            int lokacijaId           = localKomitentLokacija.GetInt("lokacijaId", 0);
            int radniNalogLokacijaId = localKomitentLokacija.GetInt("radniNalogLokacijaId", 0);

            lokacija = db.Query <DID_Lokacija>(
                "SELECT * " +
                "FROM DID_Lokacija " +
                "WHERE SAN_Id = ?", lokacijaId).FirstOrDefault();

            if (lokacija.SAN_Tip2 == 0)
            {
                tipObjekta2.Visibility = Android.Views.ViewStates.Invisible;
            }

            List <DID_RazinaInfestacije> infestacije = db.Query <DID_RazinaInfestacije>("SELECT * FROM DID_RazinaInfestacije");
            List <string> listInfestacija            = new List <string>();

            foreach (var item in infestacije)
            {
                listInfestacija.Add(item.Naziv);
            }
            ArrayAdapter <string> adapterList = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, listInfestacija);

            adapterList.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerInfestacija.Adapter = adapterList;
            spinnerInfestacija.SetSelection(listInfestacija.IndexOf("Slaba"));

            if (localPotvrda.GetBoolean("potvrdaPage1", false))
            {
                godinaInput.Text = localPotvrda.GetString("godina", null);
                DateTime date = Convert.ToDateTime(localPotvrda.GetString("datumPotvrde", null));
                datePicker.UpdateDate(date.Year, date.Month - 1, date.Day);
                opisRadaInput.Text  = localPotvrda.GetString("opisRadaInput", null);
                potvrdaBrInput.Text = localPotvrda.GetString("potvrdaBrInput", null);
                spinnerInfestacija.SetSelection(listInfestacija.IndexOf(localPotvrda.GetString("razinaInfestacije", null)));
                brojObjekata1Input.Text = localPotvrda.GetInt("lokacijaTipBrojObjekata", 0).ToString();
                brojObjekata2Input.Text = localPotvrda.GetInt("lokacijaTip2BrojObjekata", 0).ToString();
            }
        }
        private void UpdateDisplay()
        {
            if (_activityCommon == null)
            {
                return;
            }

            try
            {
                _ignoreCheckChange = true;

                List <string> selectList     = null;
                string        blockNumber    = string.Empty;
                string        defineBlockNew = string.Empty;
                string        argType        = string.Empty;
                if (!string.IsNullOrEmpty(_instanceData.Arguments))
                {
                    string[] argArray = _instanceData.Arguments.Split(";");
                    if (_mwBlock)
                    {
                        if (argArray.Length > 0)
                        {
                            defineBlockNew = argArray[0].Trim();
                            selectList     = argArray.ToList();
                            selectList.RemoveAt(0);
                        }
                    }
                    else if (_dynamicId)
                    {
                        if (argArray.Length > 2)
                        {
                            blockNumber    = argArray[0].Trim();
                            defineBlockNew = argArray[1].Trim();
                            argType        = argArray[2].Trim();
                            selectList     = argArray.ToList();
                            selectList.RemoveRange(0, 3);
                        }
                    }
                    else
                    {
                        if (argArray.Length > 0)
                        {
                            argType    = argArray[0].Trim();
                            selectList = argArray.ToList();
                            selectList.RemoveAt(0);
                        }
                    }
                }

                switch (argType.ToUpperInvariant())
                {
                case ArgTypeID:
                    _radioButtonArgTypeId.Checked = true;
                    break;

                default:
                    _radioButtonArgTypeArg.Checked = true;
                    break;
                }

                if (_dynamicId)
                {
                    Int64 numberValue = EdiabasNet.StringToValue(blockNumber, out bool valid);
                    if (!valid)
                    {
                        numberValue = 0;
                    }

                    int selection = 0;
                    int index     = 0;
                    for (int i = 0; i < 10; i++)
                    {
                        _spinnerBlockNumberAdapter.Items.Add(new StringObjType(string.Format(CultureInfo.InvariantCulture, "{0}", i), i));
                        if (i == numberValue)
                        {
                            selection = index;
                        }

                        index++;
                    }

                    _spinnerBlockNumberAdapter.NotifyDataSetChanged();
                    _spinnerBlockNumber.SetSelection(selection);
                }

                if (_mwBlock || _dynamicId)
                {
                    bool newBlock = string.IsNullOrEmpty(defineBlockNew) ||
                                    string.Compare(defineBlockNew, "JA", StringComparison.OrdinalIgnoreCase) == 0 ||
                                    string.Compare(defineBlockNew, "YES", StringComparison.OrdinalIgnoreCase) == 0;
                    _checkBoxDefineBlockNew.Checked = newBlock;
                }

                UpdateArgList(selectList);
                UpdateButtonState();
            }
            catch (Exception)
            {
                // ignored
            }
            finally
            {
                _ignoreCheckChange = false;
            }
        }
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);
            var view = inflater.Inflate (Resource.Layout.NavigationLayout, null, true);
            navigationListView = view.FindViewById<ListView> (Resource.Id.navigationListView);
            navigationStatus = view.FindViewById<Spinner> (Resource.Id.fragmentStatus);
            navigationStatusImage = view.FindViewById<ImageView> (Resource.Id.fragmentStatusImage);
            timerLayout = view.FindViewById<RelativeLayout> (Resource.Id.fragmentTimerTextLayout);
            navigationStatusLayout = view.FindViewById<LinearLayout> (Resource.Id.navigationStatusLayout);
            timer = view.FindViewById<ToggleButton> (Resource.Id.fragmentTimer);
            timerHours = view.FindViewById<TextView> (Resource.Id.fragmentHours);

            navigationStatusImage.SetImageResource (Resource.Drawable.HoldImage);
            var spinnerAdapter = new SpinnerAdapter<AssignmentStatus> (assignmentViewModel.AvailableStatuses, Activity, Resource.Layout.SimpleSpinnerItem);
            spinnerAdapter.TextColor = Color.White;
            navigationStatus.Adapter = spinnerAdapter;
            if (Assignment != null && !Assignment.IsHistory) {
                navigationStatus.ItemSelected += (sender, e) => {
                    var status = assignmentViewModel.AvailableStatuses [e.Position];
                    if (Assignment != null && Assignment.Status != status && Assignment.Status != AssignmentStatus.New) {
                        switch (status) {
                            case AssignmentStatus.Complete:
                                //go to confirmations screen
                                var currentPosition = navigationListView.SelectedItemPosition;
                                var confirmationPosition = Constants.Navigation.IndexOf ("Confirmations");
                                if (currentPosition != confirmationPosition) {
                                    navigationSelector.OnItemClick (navigationListView, navigationListView.GetChildAt (confirmationPosition), confirmationPosition, 0);
                                }
                                navigationStatus.SetSelection (assignmentViewModel.AvailableStatuses.ToList ().IndexOf (Assignment.Status));
                                break;
                            default:
                                Assignment.Status = status;
                                SaveAssignment ();
                                break;
                        }
                    }
                };
            }
            timerLayout.Visibility = ViewStates.Gone;

            var adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.Navigation);
            if (Assignment != null && Assignment.IsHistory) {
                adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.HistoryNavigation);
            }
            navigationListView.OnItemClickListener = navigationSelector;
            navigationListView.Adapter = adapter;

            timer.CheckedChange += (sender, e) => {
                if (e.IsChecked != assignmentViewModel.Recording) {
                    if (assignmentViewModel.Recording) {
                        assignmentViewModel.PauseAsync ();
                    } else {
                        assignmentViewModel.RecordAsync ();
                    }
                }
            };

            SetActiveAssignment ();

            return view;
        }
Example #42
0
        private void CreateDropDown(Context context, ImageView indicatorImage, ReportElement element, int userID)
        {
            spinner = new Spinner(context);
            RelativeLayout addMoreLayout = new RelativeLayout(context);
            ImageButton    addItem       = new ImageButton(context);

            RelativeLayout.LayoutParams paramsForSpinner = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForSpinner.AddRule(LayoutRules.AlignParentStart);
            paramsForSpinner.AddRule(LayoutRules.StartOf, addItem.Id);
            paramsForSpinner.AddRule(LayoutRules.AlignBottom, addItem.Id);
            paramsForSpinner.SetMargins(0, 0, 70, 0);
            spinner.LayoutParameters = paramsForSpinner;

            RelativeLayout.LayoutParams paramsForAddItem = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsForAddItem.AddRule(LayoutRules.AlignParentEnd);
            addItem.LayoutParameters = paramsForAddItem;
            addItem.SetImageResource(Resource.Drawable.addbutton);
            addItem.SetBackgroundResource(0);

            spinnerItemsList = new List <string>();

            for (int i = 0; i < dropDownValues.Count; i++)
            {
                spinnerItemsList.Add(dropDownValues[i].Name);
                if (dropDownValues[i].Value == "true")
                {
                    selection = i;
                    indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                }
                else
                {
                    indicatorImage.SetImageResource(0);
                }
            }

            if (dropDownValues.Count == 0)
            {
                spinner.SetSelection(0);
            }

            adapterSpinner = new ArrayAdapter <string>(context, Android.Resource.Layout.SimpleSpinnerItem, spinnerItemsList);
            //adapterSpinner = new ArrayAdapter<string>(context, Android.Resource.Layout.SimpleSpinnerDropDownItem, spinnerItemsList);
            adapterSpinner.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapterSpinner;
            spinner.SetSelection(selection);

            addItem.Click += (sender3, e) => add_item_click(sender3, e);

            spinner.ItemSelected += spinner_ItemSelected;

            if (isArcheived)
            {
                spinner.Enabled   = false;
                addItem.Enabled   = false;
                addItem.Clickable = false;
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    spinner.Enabled   = false;
                    addItem.Enabled   = false;
                    addItem.Clickable = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        spinner.Enabled   = true;
                        addItem.Enabled   = true;
                        addItem.Clickable = true;
                    }
                }

                else
                {
                    spinner.Enabled   = true;
                    addItem.Enabled   = true;
                    addItem.Clickable = true;
                }
            }
            else
            {
                spinner.Enabled   = false;
                addItem.Enabled   = false;
                addItem.Clickable = false;
            }

            if (element.AddNew)
            {
                addMoreLayout.AddView(spinner);
                addMoreLayout.AddView(addItem);
                dropDownFrame.AddView(addMoreLayout);
            }
            else
            {
                dropDownFrame.AddView(spinner);
            }
        }
        private void AddSearchFragment()
        {
            if (mSearchFragment != null)
            {
                return;
            }

            var ft             = SupportFragmentManager.BeginTransaction();
            var searchFragment = new LocationSearchFragment();

            searchFragment.SetClickListener((object sender, RecyclerClickEventArgs e) =>
            {
                var adapter = sender as LocationQueryAdapter;
                var v       = (LocationQuery)e.View;

                if (!String.IsNullOrEmpty(adapter.Dataset[e.Position].LocationQuery))
                {
                    query_vm = adapter.Dataset[e.Position];
                }
                else
                {
                    query_vm = null;
                }

                if (String.IsNullOrWhiteSpace(query_vm.LocationQuery))
                {
                    // Stop since there is no valid query
                    query_vm = null;
                    return;
                }

                // Cancel other tasks
                mSearchFragment.CtsCancel();

                ShowLoading(true);

                if (mSearchFragment.CtsCancelRequested())
                {
                    ShowLoading(false);
                    query_vm = null;
                    return;
                }

                // Check if location already exists
                if (Favorites.FirstOrDefault(l => l.query == query_vm.LocationQuery) is LocationData loc)
                {
                    ShowLoading(false);
                    ExitSearchUi();

                    // Set selection
                    query_vm = null;
                    locSpinner.SetSelection(
                        locAdapter.GetPosition(new ComboBoxItem(loc.name, loc.query)));
                    return;
                }

                if (mSearchFragment.CtsCancelRequested())
                {
                    ShowLoading(false);
                    query_vm = null;
                    return;
                }

                // We got our data so disable controls just in case
                adapter.Dataset.Clear();
                adapter.NotifyDataSetChanged();
                searchFragment.View.FindViewById <RecyclerView>(Resource.Id.recycler_view).Enabled = false;

                // Save data
                var item = new ComboBoxItem(query_vm.LocationName, query_vm.LocationQuery);
                var idx  = locAdapter.Count - 1;
                locAdapter.Insert(item, idx);
                locSpinner.SetSelection(idx);
                locSummary.Text = item.Display;

                // Hide dialog
                ShowLoading(false);
                ExitSearchUi();
            });
            searchFragment.UserVisibleHint = false;
            ft.Add(Resource.Id.search_fragment_container, searchFragment);
            ft.CommitAllowingStateLoss();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.booking_schedule);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            toolbar.MenuItemClick += Menu_Clicked;

            ISharedPreferences pref = Application.Context.GetSharedPreferences("UserInfor", FileCreationMode.Private);

            ip = pref.GetString("IP", String.Empty);

            Button btn = FindViewById <Button>(Resource.Id.btninsert);

            btn.Click += button_click;

            client = new WebClient();
            uri    = new Uri("http://" + ip + "/getServices.php");
            client.DownloadDataAsync(uri);
            client.DownloadDataCompleted += download_service;

            currentday     = Intent.GetStringExtra("dayBooking");
            currentmonth   = Intent.GetStringExtra("monthBooking");
            currenthour    = Intent.GetStringExtra("hourBooking");
            currentminute  = Intent.GetStringExtra("minuteBooking");
            currentservice = Intent.GetStringExtra("serviceBooking");

            ename = Intent.GetStringExtra("cname");
            cname = Intent.GetStringExtra("ename");
            type  = Intent.GetStringExtra("type");

            spinnerDay      = FindViewById <Spinner>(Resource.Id.spinnerDate);
            spinnerMonth    = FindViewById <Spinner>(Resource.Id.spinnerMonth);
            spinnerHour     = FindViewById <Spinner>(Resource.Id.spinnerHours);
            spinnerMinutes  = FindViewById <Spinner>(Resource.Id.spinnerMin);
            spinnerServices = FindViewById <Spinner>(Resource.Id.spinnerService);

            spinnerDay.ItemSelected      += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinnerMonth.ItemSelected    += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinnerHour.ItemSelected     += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinnerMinutes.ItemSelected  += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinnerServices.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);


            var hours = new List <string>()
            {
                "08", "09", "10", "11", "12", "13", "14", "15", "16"
            };
            var adapter0 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, hours);

            spinnerHour.Adapter = adapter0;
            spinnerHour.SetSelection(hours.IndexOf(currenthour));

            var minutes = new List <string>()
            {
                "00", "15", "30", "45"
            };
            var adapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, minutes);

            spinnerMinutes.Adapter = adapter1;
            spinnerMinutes.SetSelection(minutes.IndexOf(currentminute));

            var day = new List <string>()
            {
                "DD", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
            };
            var adapter2 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, day);

            spinnerDay.Adapter = adapter2;
            spinnerDay.SetSelection(day.IndexOf(currentday));

            var month = new List <string>()
            {
                "MM", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
            };
            var adapter3 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, month);

            spinnerMonth.Adapter = adapter3;
            spinnerMonth.SetSelection(month.IndexOf(currentmonth));

            //  Console.WriteLine("ID " + id);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            SetTheme(Resource.Style.MyTheme);
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);


            SetContentView(Resource.Layout.From_Room_Search);
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);


            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
            navigationView.SetCheckedItem(Resource.Id.nav_rooms);


            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();

            Spinner spinner  = (Spinner)FindViewById(Resource.Id.spinner1);
            Spinner spinner2 = (Spinner)FindViewById(Resource.Id.spinner2);
            Spinner spinner3 = (Spinner)FindViewById(Resource.Id.spinner3);
            Spinner spinner4 = (Spinner)FindViewById(Resource.Id.spinner4);
            Spinner spinner5 = (Spinner)FindViewById(Resource.Id.spinner5);


            var adapter = ArrayAdapter.CreateFromResource(this,
                                                          Resource.Array.planets_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);



            var adapter2 = ArrayAdapter.CreateFromResource(this,
                                                           Resource.Array.array2, Android.Resource.Layout.SimpleSpinnerItem);

            adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            var adapter3 = ArrayAdapter.CreateFromResource(this,
                                                           Resource.Array.array3, Android.Resource.Layout.SimpleSpinnerItem);

            adapter3.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);


            spinner.Adapter = adapter;


            spinner.Adapter  = adapter;
            spinner2.Adapter = adapter;
            spinner3.Adapter = adapter2;
            spinner4.Adapter = adapter3;
            spinner5.Adapter = adapter3;


            if (DateTime.Now.Hour >= 23)
            {
                spinner.SetSelection(22);

                spinner2.SetSelection(24);
            }
            else
            {
                spinner.SetSelection(DateTime.Now.Hour);

                spinner2.SetSelection(DateTime.Now.Hour + 2);
            }

            spinner5.SetSelection(42);



            _dateDisplay             = FindViewById <TextView>(Resource.Id.text_date);
            _dateSelectButton        = FindViewById <Button>(Resource.Id.button_date);
            _dateSelectButton.Click += DateSelect_OnClick;
            _dateDisplay.Text        = selectedDay.ToShortDateString();


            Button button1 = FindViewById <Button>(Resource.Id.button_ok);

            button1.Click += OnOKButton;

            // Create your application here
        }
Example #46
0
        public override View GetSampleContent(Context con)
        {
            int numerHeight = getDimensionPixelSize(con, Resource.Dimension.numeric_txt_ht);
            int width       = con.Resources.DisplayMetrics.WidthPixels - 40;

            linear = new LinearLayout(con);
            linear.SetBackgroundColor(Color.White);
            linear.Orientation = Orientation.Vertical;
            linear.SetPadding(10, 10, 10, 10);


            TextView text2 = new TextView(con);

            text2.TextSize      = 17;
            text2.TextAlignment = TextAlignment.Center;
            text2.Text          = "This sample demonstrates how to filter data within a range of Excel worksheet.";
            text2.SetTextColor(Color.ParseColor("#262626"));
            text2.SetPadding(5, 5, 5, 5);
            linear.AddView(text2);

            TextView space1 = new TextView(con);

            space1.TextSize = 10;
            linear.AddView(space1);

            m_context = con;

            LinearLayout subLinear = new LinearLayout(con);

            subLinear.Orientation = Orientation.Horizontal;

            TextView space2 = new TextView(con);

            space2.TextSize      = 17;
            space2.TextAlignment = TextAlignment.Center;
            space2.Text          = "Filter Type";
            space2.SetTextColor(Color.ParseColor("#262626"));
            space2.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            subLinear.AddView(space2);

            string[] list = { "Custom Filter", "Text Filter", "DateTime Filter", "Dynamic Filter", "Color Filter", "Icon Filter", "Advanced Filter" };
            ArrayAdapter <String> array = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleSpinnerItem, list);

            spinner         = new Spinner(con);
            spinner.Adapter = array;
            spinner.SetSelection(1);
            subLinear.AddView(spinner);
            linear.AddView(subLinear);

            advancedLinear1             = new LinearLayout(con);
            advancedLinear1.Orientation = Orientation.Horizontal;

            TextView space3 = new TextView(con);

            space3.TextSize      = 17;
            space3.TextAlignment = TextAlignment.Center;
            space3.Text          = "Filter Action";
            space3.SetTextColor(Color.ParseColor("#262626"));
            space3.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear1.AddView(space3);

            string[]     list1  = new string[] { "Filter In Place", "Filter Copy" };
            ArrayAdapter array1 = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list1);

            spinner1         = new Spinner(con);
            spinner1.Adapter = array1;
            spinner1.SetSelection(1);
            advancedLinear1.AddView(spinner1);

            advancedLinear2             = new LinearLayout(con);
            advancedLinear2.Orientation = Orientation.Horizontal;

            TextView space4 = new TextView(con);

            space4.TextSize      = 17;
            space4.TextAlignment = TextAlignment.Center;
            space4.Text          = "Unique Records";
            space4.SetTextColor(Color.ParseColor("#262626"));
            space4.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear2.AddView(space4);

            linear.AddView(advancedLinear1);
            linear.AddView(advancedLinear2);

            switch1         = new Switch(con);
            switch1.Checked = false;
            advancedLinear2.AddView(switch1);

            advancedLinear3             = new LinearLayout(con);
            advancedLinear3.Orientation = Orientation.Horizontal;

            TextView space5 = new TextView(con);

            space5.TextSize      = 17;
            space5.TextAlignment = TextAlignment.Center;
            space5.Text          = "Color Filter Type";
            space5.SetTextColor(Color.ParseColor("#262626"));
            space5.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear3.AddView(space5);

            string[]     list2  = new string[] { "Font Color", "Cell Color" };
            ArrayAdapter array2 = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list2);

            spinner2         = new Spinner(con);
            spinner2.Adapter = array2;
            spinner2.SetSelection(0);
            advancedLinear3.AddView(spinner2);

            advancedLinear4             = new LinearLayout(con);
            advancedLinear4.Orientation = Orientation.Horizontal;

            TextView space6 = new TextView(con);

            space6.TextSize      = 17;
            space6.TextAlignment = TextAlignment.Center;
            space6.Text          = "Color";
            space6.SetTextColor(Color.ParseColor("#262626"));
            space6.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear4.AddView(space6);


            string[]     list3  = new string[] { "Red", "Blue", "Green", "Yellow", "Empty" };
            ArrayAdapter array3 = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list3);

            spinner3         = new Spinner(con);
            spinner3.Adapter = array3;
            spinner3.SetSelection(0);
            advancedLinear4.AddView(spinner3);

            advancedLinear5             = new LinearLayout(con);
            advancedLinear5.Orientation = Orientation.Horizontal;

            TextView space7 = new TextView(con);

            space7.TextSize      = 17;
            space7.TextAlignment = TextAlignment.Center;
            space7.Text          = "IconSet Type";
            space7.SetTextColor(Color.ParseColor("#262626"));
            space7.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear5.AddView(space7);


            string[]     list4  = new string[] { "ThreeSymbols", "FourRating", "FiveArrows" };
            ArrayAdapter array4 = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list4);

            spinner4         = new Spinner(con);
            spinner4.Adapter = array4;
            spinner4.SetSelection(0);
            advancedLinear5.AddView(spinner4);

            advancedLinear6             = new LinearLayout(con);
            advancedLinear6.Orientation = Orientation.Horizontal;

            TextView space8 = new TextView(con);

            space8.TextSize      = 17;
            space8.TextAlignment = TextAlignment.Center;
            space8.Text          = "Icon ID";
            space8.SetTextColor(Color.ParseColor("#262626"));
            space8.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight);
            advancedLinear6.AddView(space8);


            string[]     list5  = new string[] { "RedCrossSymbol", "YellowExclamationSymbol", "GreenCheckSymbol", "NoIcon" };
            ArrayAdapter array5 = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list5);

            spinner5         = new Spinner(con);
            spinner5.Adapter = array5;
            spinner5.SetSelection(0);
            advancedLinear6.AddView(spinner5);

            string[] iconsList2 = new string[] { "SignalWithOneFillBar", "SignalWithTwoFillBars", "SignalWithThreeFillBars", "SignalWithFourFillBars", "NoIcon" };
            string[] iconsList3 = new string[] { "RedDownArrow", "YellowDownInclineArrow", "YellowSideArrow", "YellowUpInclineArrow", "GreenUpArrow", "NoIcon" };

            Button button = new Button(con);

            button.Text   = "Input Template";
            button.Click += OnButtonClicked1;
            linear.AddView(button);

            button1        = new Button(con);
            button1.Text   = "Generate Excel";
            button1.Click += OnButtonClicked;
            linear.AddView(button1);
            spinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                String selectedItem = array.GetItem(e.Position);
                if (selectedItem.Equals("Advanced Filter"))
                {
                    linear.RemoveView(button1);
                    linear.RemoveView(button);
                    linear.AddView(advancedLinear1);
                    linear.AddView(advancedLinear2);
                    linear.AddView(button);
                    linear.AddView(button1);
                    linear.RemoveView(advancedLinear3);
                    linear.RemoveView(advancedLinear4);
                    linear.RemoveView(advancedLinear5);
                    linear.RemoveView(advancedLinear6);
                }
                else if (selectedItem.Equals("Icon Filter"))
                {
                    linear.RemoveView(button);
                    linear.RemoveView(button1);
                    linear.RemoveView(advancedLinear1);
                    linear.RemoveView(advancedLinear2);
                    linear.RemoveView(advancedLinear3);
                    linear.RemoveView(advancedLinear4);
                    linear.AddView(advancedLinear5);
                    linear.AddView(advancedLinear6);
                    linear.AddView(button);
                    linear.AddView(button1);
                }
                else if (selectedItem.Equals("Color Filter"))
                {
                    linear.RemoveView(button);
                    linear.RemoveView(button1);
                    linear.RemoveView(advancedLinear1);
                    linear.RemoveView(advancedLinear2);
                    linear.RemoveView(advancedLinear5);
                    linear.RemoveView(advancedLinear6);
                    linear.AddView(advancedLinear3);
                    linear.AddView(advancedLinear4);
                    linear.AddView(button);
                    linear.AddView(button1);
                }
                else
                {
                    linear.RemoveView(advancedLinear1);
                    linear.RemoveView(advancedLinear2);
                    linear.RemoveView(advancedLinear3);
                    linear.RemoveView(advancedLinear4);
                    linear.RemoveView(advancedLinear5);
                    linear.RemoveView(advancedLinear6);
                }
            };

            spinner4.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) =>
            {
                if (spinner4.SelectedItemPosition == 0)
                {
                    spinner5.Adapter = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, list5);
                }
                else if (spinner4.SelectedItemPosition == 1)
                {
                    spinner5.Adapter = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, iconsList2);
                }
                else if (spinner4.SelectedItemPosition == 2)
                {
                    spinner5.Adapter = new ArrayAdapter(con, Android.Resource.Layout.SimpleSpinnerItem, iconsList3);
                }
            };
            return(linear);
        }
Example #47
0
        private void UpdateArgParams(List <string> selectParams = null)
        {
            try
            {
                _layoutArgParams.RemoveAllViews();
                _parameterList.Clear();
                Android.Content.Res.ColorStateList captionTextColors = _textViewArgTypeTitle.TextColors;
                Drawable captionTextBackground = _textViewArgTypeTitle.Background;
                int      position = _spinnerArgument.SelectedItemPosition;
                if (position >= 0 && position < _spinnerArgumentAdapter.ItemsVisible.Count)
                {
                    EdiabasToolActivity.ExtraInfo item = _spinnerArgumentAdapter.ItemsVisible[position];
                    if (item.Tag is EdiabasToolActivity.SgFuncInfo funcInfo)
                    {
                        if (funcInfo.ArgInfoList != null)
                        {
                            foreach (EdiabasToolActivity.SgFuncArgInfo funcArgInfo in funcInfo.ArgInfoList)
                            {
                                string selectParam = string.Empty;
                                if (selectParams != null && selectParams.Count > _parameterList.Count)
                                {
                                    selectParam = selectParams[_parameterList.Count];
                                }

                                LinearLayout argLayout = new LinearLayout(this);
                                argLayout.Orientation = Orientation.Vertical;

                                LinearLayout.LayoutParams wrapLayoutParams = new LinearLayout.LayoutParams(
                                    ViewGroup.LayoutParams.MatchParent,
                                    ViewGroup.LayoutParams.WrapContent);

                                TextView textViewCaption = new TextView(this);
                                textViewCaption.SetOnTouchListener(this);
                                textViewCaption.SetTextColor(captionTextColors);
                                textViewCaption.Background = captionTextBackground;

                                StringBuilder sbCaption = new StringBuilder();
                                sbCaption.Append(GetString(Resource.String.arg_assist_control_parameter));
                                sbCaption.Append(": ");
                                sbCaption.Append(funcArgInfo.Arg);
                                textViewCaption.Text = sbCaption.ToString();
                                argLayout.AddView(textViewCaption, wrapLayoutParams);

                                TextView      textViewDesc = null;
                                StringBuilder sbDesc       = new StringBuilder();
                                string        info         = funcArgInfo.InfoTrans ?? funcArgInfo.Info;
                                if (!string.IsNullOrEmpty(info))
                                {
                                    sbDesc.Append(info);
                                }

                                if (!string.IsNullOrEmpty(funcArgInfo.DataType))
                                {
                                    if (sbDesc.Length > 0)
                                    {
                                        sbDesc.Append("\r\n");
                                    }
                                    sbDesc.Append("Data type: ");
                                    sbDesc.Append(funcArgInfo.DataType);
                                }

                                if (!string.IsNullOrEmpty(funcArgInfo.Unit))
                                {
                                    if (sbDesc.Length > 0)
                                    {
                                        sbDesc.Append("\r\n");
                                    }
                                    sbDesc.Append("Unit: ");
                                    sbDesc.Append(funcArgInfo.Unit);
                                }


                                if (funcArgInfo.TableDataType == EdiabasToolActivity.TableDataType.Float)
                                {
                                    string minText = funcArgInfo.MinText;
                                    if (string.IsNullOrEmpty(minText))
                                    {
                                        if (funcArgInfo.Min.HasValue)
                                        {
                                            minText = string.Format(CultureInfo.InvariantCulture, "{0:0.0}", funcArgInfo.Min.Value);
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(minText))
                                    {
                                        if (sbDesc.Length > 0)
                                        {
                                            sbDesc.Append("\r\n");
                                        }
                                        sbDesc.Append("Min: ");
                                        sbDesc.Append(minText);
                                    }

                                    string maxText = funcArgInfo.MaxText;
                                    if (string.IsNullOrEmpty(maxText))
                                    {
                                        if (funcArgInfo.Max.HasValue)
                                        {
                                            maxText = string.Format(CultureInfo.InvariantCulture, "{0:0.0}", funcArgInfo.Max.Value);
                                        }
                                    }
                                    if (!string.IsNullOrEmpty(maxText))
                                    {
                                        if (sbDesc.Length > 0)
                                        {
                                            sbDesc.Append("\r\n");
                                        }
                                        sbDesc.Append("Max: ");
                                        sbDesc.Append(maxText);
                                    }
                                }

                                if (sbDesc.Length > 0)
                                {
                                    textViewDesc = new TextView(this);
                                    textViewDesc.SetOnTouchListener(this);
                                    textViewDesc.Text = sbDesc.ToString();
                                    argLayout.AddView(textViewDesc, wrapLayoutParams);
                                }

                                Drawable      defaultBackground = null;
                                List <object> itemList          = new List <object>();
                                if (funcArgInfo.NameInfoList != null && funcArgInfo.NameInfoList.Count > 0)
                                {
                                    if (funcArgInfo.NameInfoList[0] is EdiabasToolActivity.SgFuncValNameInfo)
                                    {
                                        Spinner spinner = new Spinner(this);
                                        spinner.SetOnTouchListener(this);
                                        defaultBackground = spinner.Background;
                                        StringObjAdapter spinnerAdapter = new StringObjAdapter(this);
                                        spinnerAdapter.Items.Add(new StringObjType("--", null, Android.Graphics.Color.Red));
                                        int selection = 0;
                                        int index     = 1;
                                        foreach (EdiabasToolActivity.SgFuncNameInfo funcNameInfo in funcArgInfo.NameInfoList)
                                        {
                                            if (funcNameInfo is EdiabasToolActivity.SgFuncValNameInfo valNameInfo)
                                            {
                                                spinner.Adapter = spinnerAdapter;
                                                StringBuilder sbName = new StringBuilder();
                                                sbName.Append(valNameInfo.Value);
                                                sbName.Append(": ");
                                                sbName.Append(valNameInfo.Text);
                                                spinnerAdapter.Items.Add(new StringObjType(sbName.ToString(), valNameInfo));
                                                if (string.Compare(valNameInfo.Text, selectParam, StringComparison.OrdinalIgnoreCase) == 0)
                                                {
                                                    selection = index;
                                                }
                                            }

                                            index++;
                                        }

                                        spinnerAdapter.NotifyDataSetChanged();
                                        spinner.SetSelection(selection);
                                        spinner.ItemSelected += (sender, args) =>
                                        {
                                            ValidateParams();
                                        };
                                        argLayout.AddView(spinner, wrapLayoutParams);
                                        itemList.Add(spinner);
                                    }
                                }
                                else
                                {
                                    EditText editText = new EditText(this);
                                    defaultBackground = editText.Background;
                                    editText.SetSingleLine();
                                    editText.ImeOptions = ImeAction.Done;
                                    editText.Text       = selectParam;

                                    editText.TextChanged += (sender, args) =>
                                    {
                                        ValidateParams();
                                    };

                                    editText.EditorAction += (sender, args) =>
                                    {
                                        switch (args.ActionId)
                                        {
                                        case ImeAction.Go:
                                        case ImeAction.Send:
                                        case ImeAction.Next:
                                        case ImeAction.Done:
                                        case ImeAction.Previous:
                                            ValidateParams();
                                            HideKeyboard();
                                            break;
                                        }
                                    };

                                    argLayout.AddView(editText, wrapLayoutParams);
                                    itemList.Add(editText);
                                }

                                _layoutArgParams.AddView(argLayout, wrapLayoutParams);

                                _parameterList.Add(new ParameterData(funcArgInfo, textViewCaption, textViewDesc, defaultBackground, itemList));
                            }
                        }
                    }
                }

                ValidateParams();
            }
            catch (Exception)
            {
                // ignored
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                ISharedPreferences       sharedPreferences = PreferenceManager.GetDefaultSharedPreferences(this);
                ISharedPreferencesEditor editorfacture     = sharedPreferences.Edit();

                idDevis = sharedPreferences.GetInt("IDDevis", 0);

                base.OnCreate(savedInstanceState);


                SetContentView(Resource.Layout.DetailFacture);

                Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);


                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                SupportActionBar.SetHomeButtonEnabled(true);

                toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154));
                toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71));
                SupportActionBar.Title = "Article Devis ";


                idItemDevis    = sharedPreferences.GetInt("idArticle", 0);
                btnlistarticle = FindViewById <Button>(Resource.Id.buttonListArticle);
                textArticle    = FindViewById <EditText>(Resource.Id.textInputEditTextArticle);
                textQuantite   = FindViewById <EditText>(Resource.Id.editTextQte);
                textprix       = FindViewById <EditText>(Resource.Id.editTextPrix);
                texttaux       = FindViewById <EditText>(Resource.Id.editTextRemisetaux);
                texttva        = FindViewById <EditText>(Resource.Id.editTextTvaFact);
                texttotal      = FindViewById <TextView>(Resource.Id.textViewTotal);
                spiner         = FindViewById <Spinner>(Resource.Id.spinnerTypeRemise);


                textArticle.Text  = sharedPreferences.GetString("NomArticle", "");
                textQuantite.Text = sharedPreferences.GetFloat("Qte", 0).ToString();
                textprix.Text     = sharedPreferences.GetFloat("Prix", 0).ToString();
                texttaux.Text     = sharedPreferences.GetFloat("Tauxremise", 0).ToString();
                texttva.Text      = sharedPreferences.GetFloat("TVA", 0).ToString();


                var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Produit, Android.Resource.Layout.SimpleSpinnerItem);

                //adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                //spiner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

                //spiner.Adapter = adapter;

                var btnEnregister = FindViewById <Button>(Resource.Id.buttonEnregistrerArticle);
                btnEnregister.Visibility = Android.Views.ViewStates.Invisible;
                btnlistarticle.Click    += delegate
                {
                    Intent intent = new Intent(this, typeof(ListProduits));


                    StartActivity(intent);
                };

                //btnEnregister.Click += delegate
                //{
                //    //List<Articleitem> articleitems = new List<Articleitem>();

                //    //articleitems.Add(new Articleitem(textArticle.Text, float.Parse(textQuantite.Text),float.Parse(textprix.Text)));

                //    // string Itemarticle= JsonConvert.SerializeObject(articleitems);

                //    InsertionArticleItem(textArticle.Text, float.Parse(textprix.Text), int.Parse(textQuantite.Text), int.Parse(texttva.Text), toast, float.Parse(texttaux.Text), idDevis);

                //    Intent intent = new Intent(this, typeof(Deviss));


                //    //editorfacture.PutString("Article", textArticle.Text);
                //    //editorfacture.PutFloat("Qte", float.Parse(textQuantite.Text));
                //    //editorfacture.PutFloat("Prix", float.Parse(textprix.Text));
                //    //editorfacture.Apply();
                //    //intent.PutExtra("NomArticle", textArticle.Text);
                //    //intent.PutExtra("", float.Parse(textQuantite.Text));
                //    //intent.PutExtra("prix", float.Parse(textprix.Text));
                //    //  editorfacture.PutFloat("Tauxremise", Remise);
                //    editorfacture.Apply();


                //    StartActivity(intent);

                //};

                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spiner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

                spiner.Adapter = adapter;


                //Somme = int.Parse(textQuantite.Text) * decimal.Parse(textprix.Text);

                int o = adapter.GetPosition(sharedPreferences.GetString("Tyoeremose", ""));

                spiner.SetSelection(o);
            }
            catch (System.Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }
        }
Example #49
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.AuditQuestionAnswers);
            auditID    = Intent.GetStringExtra("auditId");
            isNewAudit = Intent.GetStringExtra("isNewAudit");
            getDataForImageFile(Intent);

            TextView Question1 = FindViewById <TextView>(Resource.Id.labelQuestion1);
            TextView Question2 = FindViewById <TextView>(Resource.Id.labelQuestion2);
            TextView Question3 = FindViewById <TextView>(Resource.Id.labelQuestion3);
            TextView Question4 = FindViewById <TextView>(Resource.Id.labelQuestion4);

            EditText    Answer1        = FindViewById <EditText>(Resource.Id.Answer1);
            RadioGroup  radioGroup     = FindViewById <RadioGroup>(Resource.Id.rdoQuestion2);
            RadioButton radioButton    = FindViewById <RadioButton>(radioGroup.CheckedRadioButtonId);
            RadioButton radioButtonYes = FindViewById <RadioButton>(Resource.Id.radio_Yes);
            RadioButton radioButtonNo  = FindViewById <RadioButton>(Resource.Id.radio_No);
            var         sp             = FindViewById <Spinner>(Resource.Id.spinnerAnswer4);
            CheckBox    checkbox       = FindViewById <CheckBox>(Resource.Id.chkAnswer3);

            //Button SaveQuestion1 = FindViewById<Button>(Resource.Id.SaveQuestion1);
            //Button SaveQuestion2 = FindViewById<Button>(Resource.Id.SaveQuestion2);
            //Button SaveQuestion3 = FindViewById<Button>(Resource.Id.SaveQuestion3);
            Button SaveQuestion = FindViewById <Button>(Resource.Id.SaveQuestion);

            //Camera code
            ImageButton Camera1 = FindViewById <ImageButton>(Resource.Id.Camera1);
            ImageButton Camera2 = FindViewById <ImageButton>(Resource.Id.Camera2);
            ImageButton Camera3 = FindViewById <ImageButton>(Resource.Id.Camera3);
            ImageButton Camera4 = FindViewById <ImageButton>(Resource.Id.Camera4);

            //Camera
            fileQuestion1 = FindViewById <TextView>(Resource.Id.fileQuestion1);
            fileQuestion2 = FindViewById <TextView>(Resource.Id.fileQuestion2);
            fileQuestion3 = FindViewById <TextView>(Resource.Id.fileQuestion3);
            fileQuestion4 = FindViewById <TextView>(Resource.Id.fileQuestion4);

            fileQuestion1.Visibility = ViewStates.Gone;
            fileQuestion2.Visibility = ViewStates.Gone;
            fileQuestion3.Visibility = ViewStates.Gone;
            fileQuestion4.Visibility = ViewStates.Gone;
            var intentQuestion = new Intent(this, typeof(CameraActivity));

            OpenCamera(Camera1, "Question1", intentQuestion);
            OpenCamera(Camera2, "Question2", intentQuestion);
            OpenCamera(Camera3, "Question3", intentQuestion);
            OpenCamera(Camera4, "Question4", intentQuestion);

            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerAnswer4);

            //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Answers_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            manageTemplate.SetContext(this);
            List <TemplateQuestions> Questions = new List <TemplateQuestions>();

            Questions      = manageTemplate.GetTemplateQuestions();
            Question1.Text = Questions[0].QuestionDescription;
            Question2.Text = Questions[1].QuestionDescription;
            Question3.Text = Questions[2].QuestionDescription;
            Question4.Text = Questions[3].QuestionDescription;
            if (string.IsNullOrEmpty(isNewAudit))//view mode
            {
                SaveQuestion.Visibility = Android.Views.ViewStates.Gone;
                List <AuditAnswers> auditAnswers = manageTemplate.GetAuditAnswersByID(Convert.ToInt32(auditID));
                if (auditAnswers.Count > 0)
                {
                    Answer1.Text = auditAnswers[0].Answer;
                    if (auditAnswers[1].Answer.ToUpper() == "YES")
                    {
                        radioButtonYes.Checked = true;
                    }
                    else
                    {
                        radioButtonNo.Checked = true;
                    }
                    if (auditAnswers[2].Answer == "True")
                    {
                        checkbox.Checked = true;
                    }
                    else
                    {
                        checkbox.Checked = false;
                    }
                    ArrayAdapter answersAdapater = ArrayAdapter.CreateFromResource(
                        this, Resource.Array.Answers_array, Android.Resource.Layout.SimpleSpinnerItem);
                    spinner.SetSelection(answersAdapater.GetPosition(auditAnswers[3].Answer));

                    //camera code
                    if (auditAnswers[0].ImagePath != string.Empty)
                    {
                        GetImagePathForExisitng(auditAnswers[0].ImagePath, fileQuestion1, 1);
                    }

                    if (auditAnswers[1].ImagePath != string.Empty)
                    {
                        GetImagePathForExisitng(auditAnswers[1].ImagePath, fileQuestion2, 2);
                    }

                    if (auditAnswers[2].ImagePath != string.Empty)
                    {
                        GetImagePathForExisitng(auditAnswers[2].ImagePath, fileQuestion3, 3);
                    }

                    if (auditAnswers[3].ImagePath != string.Empty)
                    {
                        GetImagePathForExisitng(auditAnswers[3].ImagePath, fileQuestion4, 4);
                    }
                }
                else
                {
                    // Get images from gallery
                    if (image1 != string.Empty)
                    {
                        ViewImage(fileQuestion1, image1, "Question1");
                    }
                    if (image2 != string.Empty)
                    {
                        ViewImage(fileQuestion2, image2, "Question2");
                    }
                    if (image3 != string.Empty)
                    {
                        ViewImage(fileQuestion3, image3, "Question3");
                    }
                    if (image4 != string.Empty)
                    {
                        ViewImage(fileQuestion4, image4, "Question4");
                    }
                }
            }
            else
            {
                // Get images from gallery
                if (image1 != string.Empty)
                {
                    ViewImage(fileQuestion1, image1, "Question1");
                }
                if (image2 != string.Empty)
                {
                    ViewImage(fileQuestion2, image2, "Question2");
                }
                if (image3 != string.Empty)
                {
                    ViewImage(fileQuestion3, image3, "Question3");
                }
                if (image4 != string.Empty)
                {
                    ViewImage(fileQuestion4, image4, "Question4");
                }

                SaveQuestion.Click += SaveQuestion_Click;
            }

            //Video
            //var intentVideo = new Intent(this, typeof(VideoActivity));
            //recordVideo.Click += delegate
            //{
            //    pushDataForImageFile(intentVideo);
            //    StartActivity(intentVideo);
            //};
        }
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            // Set the layout
            SetContentView(Resource.Layout.ActivitySettings);
            _OfflineSwitch = FindViewById<Switch> (Resource.Id.switch1);
            _btnUploadData = FindViewById<Button>(Resource.Id.BtnUploadData);
            _btnClear = FindViewById<Button>(Resource.Id.BtnClear);
            _btnUrlSave = FindViewById<Button>(Resource.Id.BtnUrlSave);
            _btnChangePassword = FindViewById<Button>(Resource.Id.BtnChangePassword);
            _btnLog = FindViewById<Button>(Resource.Id.BtnLog);
            _edUrl = FindViewById<EditText>(Resource.Id.edUrl);
            _tvAndroidID = FindViewById<TextView>(Resource.Id.tvAndroidID);

            // Spinner for the main color of the app
            // Set the main colors
            _colors = new List<int>();
            _colors.Add(Android.Resource.Color.HoloOrangeDark);
            _colors.Add(Android.Resource.Color.HoloBlueDark);
            _colors.Add(Android.Resource.Color.DarkerGray);
            _colors.Add(Android.Resource.Color.HoloGreenDark);
            _colors.Add(Android.Resource.Color.HoloRedDark);

            // Initialze the color spinner
            _spinnerMainColor = FindViewById<Spinner>(Resource.Id.spinnerMainColor);
            MainColorViewAdapter _adapter = new MainColorViewAdapter (this,_colors);
            _spinnerMainColor.SetBackgroundColor( Resources.GetColor(DataAccessLayer.Utilities.MainColor));
            _spinnerMainColor.SetBackgroundResource(DataAccessLayer.Utilities.MainColor);
            _spinnerMainColor.Adapter = _adapter;

            // Initialize the LoginSaveOption Spinner
            _spinnerLoginSaveOption = FindViewById<Spinner>(Resource.Id.spinnerLoginSaveOption);
            LoginSaveOptionViewAdapter _LSO_adapter = new LoginSaveOptionViewAdapter(this);



            _spinnerLoginSaveOption.Adapter = _LSO_adapter;

            // Set the right selected item for the spinnerMainColor
            switch (DataAccessLayer.Utilities.MainColor)
            {
                case Android.Resource.Color.HoloOrangeDark:
                    _spinnerMainColor.SetSelection(0);
                    break;
                case Android.Resource.Color.HoloBlueDark:
                    _spinnerMainColor.SetSelection(1);
                    break;
                case Android.Resource.Color.DarkerGray:
                    _spinnerMainColor.SetSelection(2);
                    break;
                case Android.Resource.Color.HoloGreenDark:
                    _spinnerMainColor.SetSelection(3);
                    break;
                case Android.Resource.Color.HoloRedDark:
                    _spinnerMainColor.SetSelection(4);
                    break;
                default:
                    _spinnerMainColor.SetSelection(0);
                    break;
            }

            // Set the right selected item for the spinnerLoginSaveOption
            _spinnerLoginSaveOption.SetSelection(Convert.ToInt32( BusinessLayer.User.GetLoginSaveOption()));

            // Set the status of the button 
            if (UI.MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) 
                _OfflineSwitch.Checked = false;
            else
                _OfflineSwitch.Checked = true;

            // Enable or disable the Button to sync offline data
            offlineTasks =  BusinessLayer.Task.HasNewOfflineTasks();
            if (offlineTasks != 0 &&MainActivity.User.NetworkStatus  != DataAccessLayer.NetworkState.Disconnected)
                _btnUploadData.Enabled = true;
            else
                _btnUploadData.Enabled = false;

            // If the app is offline, the switch control must be disabled
            if (UI.MainActivity._networkstate == DataAccessLayer.NetworkState.Disconnected)
                _OfflineSwitch.Enabled = false;
            else
                _OfflineSwitch.Enabled = true;

            // Set the current URL
            _edUrl.Text = DataAccessLayer.Utilities.ServerIP;

            // set the android ID
            _tvAndroidID.Text = Android.Provider.Settings.Secure.GetString(this.ContentResolver,
                Android.Provider.Settings.Secure.AndroidId); 
            
            // Set the event handler of the controls 
            SetControlEvents(true);

        }
        //SuggestClient Api;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            // Create your application here
            SetContentView(Resource.Layout.Pharmacy);

            FindViewById <Button>(Resource.Id.paCloseB).Click += (s, e) => {
                Finish();
            };

            FindViewById <Button>(Resource.Id.paSaveB).Click += (s, e) => {
                var transaction = MainDatabase.BeginTransaction();

                Pharmacy item;
                if (Pharmacy == null)
                {
                    item           = MainDatabase.Create2 <Pharmacy>();
                    item.CreatedAt = DateTimeOffset.Now;

                    /* Contracts */
                    if (!string.IsNullOrEmpty(ContractsNames.Text))
                    {
                        var ll            = ContractsNames.Parent as LinearLayout;
                        var contractUUIDs = (string)ll.GetTag(Resource.String.ContractUUIDs);
                        if (!string.IsNullOrEmpty(contractUUIDs))
                        {
                            foreach (var contract in contractUUIDs.Split(';'))
                            {
                                var contractData = MainDatabase.Create <ContractData>();
                                contractData.Pharmacy = item.UUID;
                                contractData.Contract = contract;
                            }
                        }
                    }
                    /* ./Contracts */
                }
                else
                {
                    item = Pharmacy;

                    /* Contracts */
                    if (string.IsNullOrEmpty(ContractsNames.Text))
                    {
                        var contractDatas = MainDatabase.GetPharmacyDatas <ContractData>(item.UUID);
                        foreach (var contractData in contractDatas)
                        {
                            MainDatabase.DeleteEntity(transaction, contractData);;
                        }
                        contractDatas = null;
                    }
                    else
                    {
                        var ll            = ContractsNames.Parent as LinearLayout;
                        var contractUUIDs = (string)ll.GetTag(Resource.String.ContractUUIDs);
                        if (!string.IsNullOrEmpty(contractUUIDs))
                        {
                            var contracts     = contractUUIDs.Split(';');
                            var contractDatas = MainDatabase.GetPharmacyDatas <ContractData>(item.UUID);
                            foreach (var contractData in contractDatas)
                            {
                                MainDatabase.DeleteEntity(transaction, contractData);
                            }
                            contractDatas = null;
                            foreach (var contract in contractUUIDs.Split(';'))
                            {
                                var contractData = MainDatabase.Create2 <ContractData>();
                                contractData.Pharmacy = item.UUID;
                                contractData.Contract = contract;
                            }
                        }
                    }
                    /* ./Contracts */
                }

                item.UpdatedAt = DateTimeOffset.Now;
                item.IsSynced  = false;
                item.SetState((PharmacyState)State.SelectedItemPosition);
                item.Brand      = FindViewById <EditText>(Resource.Id.paBrandET).Text;
                item.NumberName = FindViewById <EditText>(Resource.Id.paNumberNameET).Text;
                item.LegalName  = FindViewById <EditText>(Resource.Id.paLegalNameET).Text;

                if (string.IsNullOrEmpty(NetName.Text))
                {
                    item.Net = string.Empty;
                }
                else
                {
                    item.Net = NetUUID;
                }

                var address = FindViewById <AutoCompleteTextView>(Resource.Id.paAddressACTV);
                item.Address = address.Text;
                bool isChanged = (bool)address.GetTag(Resource.String.IsChanged);
                if (isChanged)
                {
                    item.AddressFiasId = (string)address.GetTag(Resource.String.fias_id);
                    item.AddressQCGeo  = (string)address.GetTag(Resource.String.qc_geo);
                    item.AddressGeoLat = (string)address.GetTag(Resource.String.geo_lat);
                    item.AddressGeoLon = (string)address.GetTag(Resource.String.geo_lon);
                }

                if (string.IsNullOrEmpty(Subway.Text))
                {
                    item.Subway = string.Empty;
                }
                else
                {
                    var subwayUUID = (string)Subway.GetTag(Resource.String.SubwayUUID);
                    if (!string.IsNullOrEmpty(subwayUUID))
                    {
                        item.Subway = subwayUUID;
                    }
                }

                if (string.IsNullOrEmpty(Region.Text))
                {
                    item.Region = string.Empty;
                }
                else
                {
                    var regionUUID = (string)Region.GetTag(Resource.String.RegionUUID);
                    if (!string.IsNullOrEmpty(regionUUID))
                    {
                        item.Region = regionUUID;
                    }
                }

                item.Phone = FindViewById <EditText>(Resource.Id.paPhoneET).Text;

                if (string.IsNullOrEmpty(Place.Text))
                {
                    item.Place = string.Empty;
                }
                else
                {
                    var placeUUID = (string)Place.GetTag(Resource.String.PlaceUUID);
                    if (!string.IsNullOrEmpty(placeUUID))
                    {
                        item.Place = placeUUID;
                    }
                }

                if (Category.SelectedItemPosition > 0)
                {
                    item.Category = Categories[Category.SelectedItemPosition].uuid;
                }
                else
                {
                    item.Category = string.Empty;
                }
                //if (string.IsNullOrEmpty(Category.Text)) {
                //	item.Category = string.Empty;
                //} else {
                //	var categoryUUID = (string)Category.GetTag(Resource.String.CategoryUUID);
                //	if (!string.IsNullOrEmpty(categoryUUID)) {
                //		item.Category = categoryUUID;
                //	}
                //}
                item.TurnOver = Helper.ToInt(FindViewById <EditText>(Resource.Id.paTurnOverET).Text);
                item.Comment  = FindViewById <EditText>(Resource.Id.paCommentET).Text;

                if (!item.IsManaged)
                {
                    MainDatabase.SaveEntity(transaction, item);
                }

                transaction.Commit();

                //var sync = new SyncItem() {
                //	Path = @"Pharmacy",
                //	ObjectUUID = Pharmacy.UUID,
                //	JSON = JsonConvert.SerializeObject(Pharmacy)
                //};

                //MainDatabase.AddToQueue(sync);

                //StartService(new Intent("com.xamarin.SyncService"));
                GetSharedPreferences(MainActivity.C_MAIN_PREFS, FileCreationMode.Private)
                .Edit()
                .PutString(MainActivity.C_SAVED_PHARMACY_UUID, item.UUID)
                .Commit();

                Finish();
            };

            //Api = new SuggestClient(Secret.DadataApiToken, Secret.DadataApiURL);


            #region State
            State  = FindViewById <Spinner>(Resource.Id.paStateS);
            States = MainDatabase.GetStates();
            var stateAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, States.ToArray());
            stateAdapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
            State.Adapter = stateAdapter;
            #endregion

            #region Net
            Nets    = MainDatabase.GetNets();
            NetName = FindViewById <AutoCompleteTextView>(Resource.Id.paNetACTV);
            var netChoiceButton = FindViewById <Button>(Resource.Id.paNetB);
            netChoiceButton.Click += (object sender, EventArgs e) => {
                new AlertDialog.Builder(this)
                .SetTitle("Аптечная сеть")
                .SetCancelable(true)
                .SetItems(Nets.Select(item => item.name).ToArray(), (caller, arguments) => {
                    SetNet(arguments.Which);
                    //Toast.MakeText(this, @"Selected " + arguments.Which, ToastLength.Short).Show();
                })
                .Show();
            };
            #endregion

            ContractsNames         = FindViewById <AutoCompleteTextView>(Resource.Id.paContractsACTV);
            ContractsChoice        = FindViewById <Button>(Resource.Id.paContractsB);
            ContractsChoice.Click += ContractsChoice_Click;

            Address = FindViewById <AutoCompleteTextView>(Resource.Id.paAddressACTV);
            Address.SetTag(Resource.String.IsChanged, false);

            Subway = FindViewById <AutoCompleteTextView>(Resource.Id.paSubwayACTV);

            Region = FindViewById <AutoCompleteTextView>(Resource.Id.paRegionACTV);

            Place = FindViewById <AutoCompleteTextView>(Resource.Id.paPlaceACTV);

            //Category = FindViewById<AutoCompleteTextView>(Resource.Id.paCategoryACTV);

            #region Category
            Category   = FindViewById <Spinner>(Resource.Id.paCategoryS);
            Categories = new List <Category>();
            Categories.Add(new Category {
                name = @"Выберите категорию!", uuid = Guid.Empty.ToString()
            });
            Categories.AddRange(MainDatabase.GetItems <Category>());;
            var categoryAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, Categories.Select(cat => cat.name).ToArray());
            categoryAdapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
            Category.Adapter = categoryAdapter;
            #endregion

            var pharmacyUUID = Intent.GetStringExtra("UUID");
            if (string.IsNullOrEmpty(pharmacyUUID))
            {
                var shared    = GetSharedPreferences(MainActivity.C_MAIN_PREFS, FileCreationMode.Private);
                var agentUUID = shared.GetString(SigninDialog.C_AGENT_UUID, string.Empty);
                try {
                    var agent = MainDatabase.GetItem <Agent>(agentUUID);
                    Address.Text = agent.city;
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }

                FindViewById <TextView>(Resource.Id.paInfoTV).Text = @"ДОБАВЛЕНИЕ НОВОЙ АПТЕКИ";
                FindViewById <TableRow>(Resource.Id.paRowLastAttendance).Visibility     = ViewStates.Gone;
                FindViewById <TableRow>(Resource.Id.paRowNextAttendanceDate).Visibility = ViewStates.Gone;

                InitViews();
                return;
            }

            Pharmacy = MainDatabase.GetEntity <Pharmacy>(pharmacyUUID);

            FindViewById <TextView>(Resource.Id.paInfoTV).Text = "АПТЕКА : " + Pharmacy.GetName();

            FindViewById <TextView>(Resource.Id.paUUIDTV).Text = Pharmacy.UUID;

            State.SetSelection((int)Pharmacy.GetState());
            FindViewById <EditText>(Resource.Id.paBrandET).Text      = Pharmacy.Brand;
            FindViewById <EditText>(Resource.Id.paNumberNameET).Text = Pharmacy.NumberName;
            FindViewById <EditText>(Resource.Id.paLegalNameET).Text  = Pharmacy.LegalName;

            //NetName.Text = string.IsNullOrEmpty(Pharmacy.Net) ?
            //	string.Empty : MainDatabase.GetNet(Pharmacy.Net).name;
            //NetUUID = Pharmacy.Net;

            if (!string.IsNullOrEmpty(Pharmacy.Net))
            {
                SetNet(Nets.FindIndex(net => string.Compare(net.uuid, Pharmacy.Net) == 0));
            }

            ContractDatas = MainDatabase.GetPharmacyDatas <ContractData>(Pharmacy.UUID);
            if (ContractDatas.Count > 0)
            {
                ContractsNames.Text = string.Join(", ", ContractDatas.Select(cd => MainDatabase.GetItem <Contract>(cd.Contract).name).ToArray());
                var ll = ContractsNames.Parent as LinearLayout;
                ll.SetTag(Resource.String.ContractUUIDs,
                          string.Join(@";", ContractDatas.Select(cd => cd.Contract).ToArray())
                          );
            }
            Address.Text = Pharmacy.Address;

            Subway.Text = string.IsNullOrEmpty(Pharmacy.Subway) ?
                          string.Empty : MainDatabase.GetItem <Subway>(Pharmacy.Subway).name;

            Region.Text = string.IsNullOrEmpty(Pharmacy.Region) ?
                          string.Empty : MainDatabase.GetItem <Region>(Pharmacy.Region).name;

            FindViewById <EditText>(Resource.Id.paPhoneET).Text = Pharmacy.Phone;

            Place.Text = string.IsNullOrEmpty(Pharmacy.Place) ?
                         string.Empty : MainDatabase.GetItem <Place>(Pharmacy.Place).name;

            //Category.Text = string.IsNullOrEmpty(Pharmacy.Category) ?
            //	string.Empty : MainDatabase.GetItem<Category>(Pharmacy.Category).name;
            if (!string.IsNullOrEmpty(Pharmacy.Category))
            {
                Category.SetSelection(Categories.FindIndex(cat => string.Compare(cat.uuid, Pharmacy.Category) == 0));
            }

            FindViewById <EditText>(Resource.Id.paTurnOverET).Text = Pharmacy.TurnOver.HasValue ?
                                                                     Pharmacy.TurnOver.Value.ToString() : string.Empty;

            FindViewById <TextView>(Resource.Id.paLastAttendanceTV).Text = Pharmacy.LastAttendanceDate.HasValue ?
                                                                           Pharmacy.LastAttendanceDate.Value.ToString(@"dd.MM.yyyy") : @"<нет визита>";

            FindViewById <TextView>(Resource.Id.paNextAttendanceDateTV).Text = Pharmacy.NextAttendanceDate.HasValue ?
                                                                               Pharmacy.NextAttendanceDate.Value.ToString(@"dd.MM.yyyy") : DateTimeOffset.Now.ToString(@"dd.MM.yyyy");

            FindViewById <EditText>(Resource.Id.paCommentET).Text = Pharmacy.Comment;


            InitViews();
        }
        protected override void OnCreate(Bundle bundle)
        {
            CheckInternetConnection();
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Profile);
            //st.Start();
            try
            {
                ///LoggingClass.UploadErrorLogs(LoggingClass.CreateDirectoryForLogs());
                LoggingClass.LogInfo("Entered into Profile Activity", screenid);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                int            userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper sw     = new ServiceWrapper();
                var            output = sw.GetCustomerDetails(userId).Result;
                propicimage = FindViewById <ImageView>(Resource.Id.propic);
                DownloadAsync(this, System.EventArgs.Empty);
                //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                //string path = pppd.CreateDirectoryForPictures();
                //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

                //var filePath = System.IO.Path.Combine(path + "/" + userId + ".jpg");
                //if (System.IO.File.Exists(filePath))
                //{

                //    Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath);
                //    if (imageBitmap == null)
                //    {
                //        propicimage.SetImageResource(Resource.Drawable.user1);
                //        propicimage.Dispose();
                //    }
                //    else
                //    {
                //        propicimage.SetImageBitmap(imageBitmap);
                //        propicimage.Dispose();
                //    }
                //}
                //else
                //{
                //    Bitmap imageBitmap = BlobWrapper.ProfileImages(userId);
                //    if (imageBitmap == null)
                //    {
                //        propicimage.SetImageResource(Resource.Drawable.user1);
                //    }
                //    else
                //    {
                //        propicimage.SetImageBitmap(imageBitmap);
                //    }
                //}
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);


                ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic);
                changepropic.Click += delegate
                {
                    LoggingClass.LogInfo("Clicked on change propic", screenid);
                    Intent intent = new Intent(this, typeof(ProfilePicturePickDialog));
                    StartActivity(intent);
                };
                changepropic.Dispose();
                EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName);
                Firstname.Text = output.customer.FirstName;
                EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName);
                Lastname.Text = output.customer.LastName;
                EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber);
                string   phno1        = output.customer.PhoneNumber;
                string   phno2        = output.customer.Phone2;
                if (phno1 != null)
                {
                    Mobilenumber.Text = phno1;
                }
                else
                {
                    Mobilenumber.Text = phno2;
                }
                EditText Email = FindViewById <EditText>(Resource.Id.txtEmail);

                Email.Text = output.customer.Email;

                EditText Address = FindViewById <EditText>(Resource.Id.txtAddress);
                string   Addres2 = output.customer.Address2;
                string   Addres1 = output.customer.Address1;
                Address.Text = string.Concat(Addres1, Addres2);
                //EditText City = FindViewById<EditText>(Resource.Id.txtCity);
                //City.Text = output.customer.CardNumber;
                //if (CurrentUser.getUserId() != null)
                //{
                //	City.Enabled = false;
                //}
                //else { City.Enabled = true; }
                EditText PinCode = FindViewById <EditText>(Resource.Id.txtZip);


                PinCode.Text = output.customer.Zip;



                Button  updatebtn = FindViewById <Button>(Resource.Id.UpdateButton);
                Spinner spn       = FindViewById <Spinner>(Resource.Id.spinner);
                Spinner Prefered  = FindViewById <Spinner>(Resource.Id.spinner1);
                //spn.SetSelection(4);

                string        state         = output.customer.State;
                int           Preferedstore = output.customer.PreferredStore;
                List <string> storelist     = new List <string>();
                storelist.Add("--select--");
                storelist.Add("Wall");
                storelist.Add("PointPleasent");
                storelist.Add("Both");
                gifImageView = FindViewById <ImageView>(Resource.Id.gifImageView1);
                //gifImageView.StartAnimation();

                List <string> StateList = new List <string>();
                StateList.Add("AL");
                StateList.Add("AK");
                StateList.Add("AZ");
                StateList.Add("AR");
                StateList.Add("CA");
                StateList.Add("CO");
                StateList.Add("CT");
                StateList.Add("DE");
                StateList.Add("FL");
                StateList.Add("GA");
                StateList.Add("HI");
                StateList.Add("ID");
                StateList.Add("IL");
                StateList.Add("IN");
                StateList.Add("IA");
                StateList.Add("KS");
                StateList.Add("KY");
                StateList.Add("LA");
                StateList.Add("ME");
                StateList.Add("MD");
                StateList.Add("MA");
                StateList.Add("MI");
                StateList.Add("MN");
                StateList.Add("MS");
                StateList.Add("MO");
                StateList.Add("MT");
                StateList.Add("NE");
                StateList.Add("NV");
                StateList.Add("NH");
                StateList.Add("NJ");
                StateList.Add("NM");
                StateList.Add("NY");
                StateList.Add("NC");
                StateList.Add("ND");
                StateList.Add("OH");
                StateList.Add("OK");
                StateList.Add("OR");
                StateList.Add("PA");
                StateList.Add("RI");
                StateList.Add("SC");
                StateList.Add("SD");
                StateList.Add("TN");
                StateList.Add("TX");
                StateList.Add("UT");
                StateList.Add("VT");
                StateList.Add("VA");
                StateList.Add("WA");
                StateList.Add("WV");
                StateList.Add("WI");
                StateList.Add("WY");
                int i = StateList.IndexOf(state.ToString());
                spn.SetSelection(i);
                //int p = storelist.IndexOf(Prefered.SelectedItem.ToString());
                Prefered.SetSelection(Preferedstore);
                inputManager.HideSoftInputFromWindow(Firstname.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(Lastname.WindowToken, 0);

                inputManager.HideSoftInputFromWindow(Address.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(PinCode.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(Email.WindowToken, 0);
                if (CurrentUser.getUserId() == null)
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    aler.SetTitle("Sorry");
                    aler.SetMessage("This feature is available only  for VIP Users");
                    aler.SetNegativeButton("Ok", delegate
                    {
                        var intent = new Intent(this, typeof(TabActivity));
                        StartActivity(intent);
                    });
                    Dialog dialog1 = aler.Create();
                    dialog1.Show();
                }
                else
                {
                    updatebtn.Click += async delegate
                    {
                        if ((Email.Text.Contains("@")) == false || (Email.Text.Contains(".")) == false)
                        {
                            AndHUD.Shared.ShowErrorWithStatus(this, "Email is invalid", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else if ((PinCode.Text.Length != 5))
                        {
                            AndHUD.Shared.ShowErrorWithStatus(this, "Zipcode is invalid", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else
                        {
                            AndHUD.Shared.Show(this, "Please Wait", Convert.ToInt32(MaskType.Clear));
                            //int p = storelist.IndexOf(Prefered.SelectedItem.ToString());
                            //Prefered.SetSelection(p);
                            Customer customer = new Customer()
                            {
                                FirstName   = Firstname.Text,
                                LastName    = Lastname.Text,
                                PhoneNumber = Mobilenumber.Text,
                                Address1    = Address.Text,
                                Email       = Email.Text,
                                CustomerID  = userId,
                                //State = State.Text,
                                State = spn.SelectedItem.ToString(),

                                //City = City.Text
                                //CardNumber = City.Text,
                                Zip            = PinCode.Text,
                                PreferredStore = Convert.ToInt32(Prefered.SelectedItemId)
                            };
                            CurrentUser.SavePrefered(Convert.ToInt32(Prefered.SelectedItemId));
                            LoggingClass.LogInfo("Clicked on update info", screenid);
                            var x = await sw.UpdateCustomer(customer);

                            if (x == 1)
                            {
                                Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show();
                            }
                            AndHUD.Shared.Dismiss();
                            AndHUD.Shared.ShowSuccess(this, "Profile Updated", MaskType.Clear, TimeSpan.FromSeconds(2));
                            //                  var intent = new Intent(this, typeof(TabActivity));
                            //StartActivity(intent);
                        }
                    };
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
            //st.Stop();
            //LoggingClass.LogTime("Profile activity", st.Elapsed.TotalSeconds.ToString());
            ProgressIndicator.Hide();
        }
Example #53
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.EmployeeDialog, container, false);

            view.FindViewById <Button>(Resource.Id.edCloseB).Click += (s, e) => {
                Dismiss();
            };

            view.FindViewById <Button>(Resource.Id.edSaveB).Click += (s, e) => {
                var transaction = MainDatabase.BeginTransaction();

                Employee item;
                if (Employee == null)
                {
                    //item = MainDatabase.Create<Employee>();
                    item          = MainDatabase.Create2 <Employee>();
                    item.Pharmacy = Pharmacy.UUID;
                    //item.CreatedAt = DateTimeOffset.Now;
                }
                else
                {
                    item = Employee;
                }
                item.UpdatedAt = DateTimeOffset.Now;

                item.Name       = view.FindViewById <EditText>(Resource.Id.edNameET).Text;
                item.Position   = Positions[Position.SelectedItemPosition].uuid;
                item.IsCustomer = view.FindViewById <CheckBox>(Resource.Id.edIsCustomerCB).Checked;

                /* BirthDate */
                string             birthDate = view.FindViewById <EditText>(Resource.Id.edBirthDateET).Text;
                DateTimeFormatInfo fmt       = new CultureInfo("ru-RU").DateTimeFormat;
                if (!string.IsNullOrEmpty(birthDate))
                {
                    DateTimeOffset dtoBirthDate;
                    if (DateTimeOffset.TryParse(birthDate, fmt, DateTimeStyles.None, out dtoBirthDate))
                    {
                        item.BirthDate = dtoBirthDate;
                    }
                }
                /* ./BirthDate */

                item.Phone          = view.FindViewById <EditText>(Resource.Id.edPhoneET).Text;
                item.Email          = view.FindViewById <EditText>(Resource.Id.edEmailET).Text;
                item.CanParticipate = view.FindViewById <CheckBox>(Resource.Id.edCanParticipateCB).Checked;
                item.Comment        = view.FindViewById <EditText>(Resource.Id.edCommentET).Text;

                if (!item.IsManaged)
                {
                    MainDatabase.SaveEntity(transaction, item);
                }

                transaction.Commit();

                //var sync = new SyncItem()
                //{
                //	Path = @"Employee",
                //	ObjectUUID = employee.UUID,
                //	JSON = JsonConvert.SerializeObject(employee)
                //};

                //MainDatabase.AddToQueue(sync);

                //context.StartService(new Intent("com.xamarin.SyncService"));

                OnAfterSaved(EventArgs.Empty);

                Dismiss();
            };

            Dialog.SetCanceledOnTouchOutside(false);

            /* <Position> */
            Position  = view.FindViewById <Spinner>(Resource.Id.edPositionS);
            Positions = MainDatabase.GetItems <Position>();
            var positionAdapter = new ArrayAdapter(
                Activity, Android.Resource.Layout.SimpleSpinnerItem, Positions.Select(x => x.name).ToArray()
                );

            positionAdapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
            Position.Adapter = positionAdapter;
            /* </Position> */


            if (Employee == null)
            {
                Dialog.SetTitle("НОВЫЙ СОТРУДНИК");

                return(view);
            }

            Dialog.SetTitle("СОТРУДНИК : " + Employee.Name);

            view.FindViewById <TextView>(Resource.Id.edUUIDTV).Append(Employee.UUID);
            if (!string.IsNullOrEmpty(Employee.Name))
            {
                view.FindViewById <EditText>(Resource.Id.edNameET).Append(Employee.Name);
            }
            if (!string.IsNullOrEmpty(Employee.Position))
            {
                Position.SetSelection(Positions.FindIndex(item => string.Compare(item.uuid, Employee.Position) == 0));
            }
            view.FindViewById <CheckBox>(Resource.Id.edIsCustomerCB).Checked = Employee.IsCustomer;

            if (Employee.BirthDate.HasValue)
            {
                view.FindViewById <EditText>(Resource.Id.edBirthDateET).Append(Employee.BirthDate.Value.ToString("dd.MM.yyyy"));
            }

            if (!string.IsNullOrEmpty(Employee.Phone))
            {
                view.FindViewById <EditText>(Resource.Id.edPhoneET).Append(Employee.Phone);
            }
            if (!string.IsNullOrEmpty(Employee.Email))
            {
                view.FindViewById <EditText>(Resource.Id.edEmailET).Append(Employee.Email);
            }

            view.FindViewById <CheckBox>(Resource.Id.edCanParticipateCB).Checked = Employee.CanParticipate;

            if (!string.IsNullOrEmpty(Employee.Comment))
            {
                view.FindViewById <EditText>(Resource.Id.edCommentET).Append(Employee.Comment);
            }

            return(view);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(WindowFeatures.ActionBar);

            SetContentView(Resource.Layout.UpdatePersonalInformation);

            //**************************************************//
            ScreenComeFrom = Intent.GetStringExtra("ScreenComeFrom") ?? "";

            ActionBar.NavigationMode = ActionBarNavigationMode.Standard;

            if (ScreenComeFrom.Equals("HomeMenu"))
            {
                var upArrow = Resources.GetDrawable(Resource.Drawable.abc_ic_ab_back_mtrl_am_alpha);
                upArrow.SetColorFilter(Color.ParseColor("#006571"), PorterDuff.Mode.SrcIn);
                ActionBar.SetHomeAsUpIndicator(upArrow);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetHomeButtonEnabled(true);
            }



            LinearLayout lLayout = new LinearLayout(this);

            lLayout.SetGravity(GravityFlags.CenterVertical);
            LinearLayout.LayoutParams textViewParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
            textViewParameters.RightMargin = (int)(30 * this.Resources.DisplayMetrics.Density);

            TextView myTitle = new TextView(this);

            myTitle.Text     = "View/Update Personal Information";
            myTitle.TextSize = 20;
            myTitle.Gravity  = GravityFlags.Center;
            lLayout.AddView(myTitle, textViewParameters);

            ActionBar.LayoutParams actionbarParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MatchParent, ActionBar.LayoutParams.MatchParent);
            ActionBar.SetCustomView(lLayout, actionbarParams);
            ActionBar.SetDisplayShowCustomEnabled(true);

            //**************************************************//

            et_StreetAddress1 = FindViewById <EditText>(Resource.Id.et_StreetAddress1);
            //et_StreetAddress1.FocusChange += Et_StreetAddress1_FocusChange;

            et_StreetAddress2 = FindViewById <EditText>(Resource.Id.et_StreetAddress2);
            //et_StreetAddress2.FocusChange += Et_StreetAddress1_FocusChange;

            et_StreetAddress3 = FindViewById <EditText>(Resource.Id.et_StreetAddress3);
            //et_StreetAddress3.FocusChange += Et_StreetAddress1_FocusChange;

            et_StreetSuburb = FindViewById <EditText>(Resource.Id.et_StreetSuburb);
            //et_StreetSuburb.FocusChange += Et_StreetAddress1_FocusChange;

            et_StreetState = FindViewById <EditText>(Resource.Id.et_StreetState);
            //et_StreetState.FocusChange += Et_StreetAddress1_FocusChange;

            et_StreetPostCode = FindViewById <EditText>(Resource.Id.et_StreetPostcode);
            //et_StreetPostCode.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailAddress1 = FindViewById <EditText>(Resource.Id.et_MailAddress1);
            //et_MailAddress1.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailAddress2 = FindViewById <EditText>(Resource.Id.et_MailAddress2);
            //et_MailAddress2.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailAddress3 = FindViewById <EditText>(Resource.Id.et_MailAddress3);
            //et_MailAddress3.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailSuburb = FindViewById <EditText>(Resource.Id.et_MailSuburb);
            //et_MailSuburb.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailState = FindViewById <EditText>(Resource.Id.et_MailState);
            //et_MailState.FocusChange += Et_StreetAddress1_FocusChange;

            et_MailPostCode = FindViewById <EditText>(Resource.Id.et_MailPostcode);
            //et_MailPostCode.FocusChange += Et_StreetAddress1_FocusChange;

            et_HomePhone = FindViewById <EditText>(Resource.Id.et_HomePhone);
            //et_HomePhone.FocusChange += Et_StreetAddress1_FocusChange;

            et_WorkPhone = FindViewById <EditText>(Resource.Id.et_WorkPhone);
            //et_WorkPhone.FocusChange += Et_StreetAddress1_FocusChange;

            et_MobilePhone = FindViewById <EditText>(Resource.Id.et_MobilePhone);
            //et_MobilePhone.FocusChange += Et_StreetAddress1_FocusChange;

            et_Email = FindViewById <EditText>(Resource.Id.et_Email);
            //et_Email.FocusChange += Et_StreetAddress1_FocusChange;


            bt_Continue        = FindViewById <Button>(Resource.Id.bt_Continue);
            bt_Continue.Click += Bt_Continue_Click;

            err_MobilePhone = FindViewById <TextView>(Resource.Id.err_MobilePhone);


            listPrefer.Add("");
            listPrefer.Add("Home Phone");
            listPrefer.Add("Work Phone");
            listPrefer.Add("Mobile Phone");

            spinner_Prefer  = FindViewById <Spinner>(Resource.Id.spinner_Prefer);
            callBackAdapter = new CallbackTimeSpinnerAdapter(this, this.listPrefer);

            spinner_Prefer.Adapter = callBackAdapter;

            spinner_Prefer.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Prefer_ItemSelected);

            GetPersonalInfo();

            spinner_Prefer.SetSelection(selectedIndex);

            if (!ScreenComeFrom.Equals("HomeMenu"))
            {
                var_TransactionDescription = Intent.GetStringExtra("tv_TransactionDescription") ?? "";
                var_ReceiptNumber          = Intent.GetStringExtra("tv_ReceiptNumber") ?? "";
                var_Amount        = Intent.GetStringExtra("tv_Amount") ?? "";
                var_Time          = Intent.GetStringExtra("tv_Time") ?? "";
                var_Date          = Intent.GetStringExtra("tv_Date") ?? "";
                var_Name          = Intent.GetStringExtra("tv_Name") ?? "";
                var_PaymentType   = Intent.GetIntExtra("PaymentType", 0);
                var_PaymentMethod = Intent.GetIntExtra("PaymentMethod", 0);
                var_PaymentId     = Intent.GetIntExtra("PaymentId", 0);
                var_ClientName    = Intent.GetStringExtra("ClientName") ?? "";
                var_FirstDebtorPaymentInstallmentId = Intent.GetIntExtra("FirstDebtorPaymentInstallmentId", 0);
            }
        }
Example #55
0
        private void CultureLayout(Context context)
        {
            //Culture Text
            TextView cultureLabel = new TextView(context);

            cultureLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);
            cultureLabel.TextSize         = 15;
            cultureLabel.Text             = "Culture";
            cultureSpinner = new Spinner(context, SpinnerMode.Dialog);
            cultureSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center);

            //Culture List
            List <String> cultureList = new List <String>();

            cultureList.Add("Chinese");
            cultureList.Add("Spanish");
            cultureList.Add("English");
            cultureList.Add("French");
            //Data Adapter
            dataAdapter = new ArrayAdapter <String>
                              (context, Android.Resource.Layout.SimpleSpinnerItem, cultureList);
            dataAdapter.SetDropDownViewResource
                (Android.Resource.Layout.SimpleSpinnerDropDownItem);

            //cultureSpinner
            cultureSpinner.Adapter = dataAdapter;
            cultureSpinner.SetSelection(cultureSpinnerPosition);

            //Culture Item Selected Listener
            cultureSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
                String selectedItem = dataAdapter.GetItem(e.Position);
                cultureSpinnerPosition = e.Position;
                if (selectedItem.Equals("Chinese"))
                {
                    localinfo = Java.Util.Locale.China; //new Java.Util.Locale("en","US");
                }
                if (selectedItem.Equals("Spanish"))
                {
                    localinfo = new Java.Util.Locale("es", "AR");
                }
                if (selectedItem.Equals("English"))
                {
                    localinfo = Java.Util.Locale.Us;
                }
                if (selectedItem.Equals("French"))
                {
                    localinfo = Java.Util.Locale.France;
                }
                ApplyChanges();
            };

            //cultureLayout
            LinearLayout cultureLayout = new LinearLayout(context);

            cultureLayout.Orientation = Android.Widget.Orientation.Horizontal;
            cultureLayout.AddView(cultureLabel);
            cultureLayout.AddView(cultureSpinner);
            proprtyOptionsLayout.AddView(cultureLayout);

            //spaceText
            TextView spaceText2 = new TextView(context);

            spaceText2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 60, GravityFlags.Center);
            proprtyOptionsLayout.AddView(spaceText2);

            TextView spaceLabel = new TextView(context);

            spaceLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.167), ViewGroup.LayoutParams.WrapContent);

            //layout1
            LinearLayout layout1 = new LinearLayout(context);

            layout1.Orientation = Android.Widget.Orientation.Horizontal;
            layout1.AddView(spaceLabel);
            layout1.AddView(proprtyOptionsLayout);

            //propertylayout
            propertylayout.AddView(topProperty);
            propertylayout.AddView(layout1);
        }
Example #56
0
		public void Restore(MainActivity mainActivity)
		{
			// First assign the new mainActivity
			_mainActivity = mainActivity;

            // Then we have to get reference to the new controls
            _btnNew = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnNew);
            _btnEdit = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnEdit);
            _btnSave = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnSave);
            _btnDelete = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnDelete);
            _btnOffline = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnOffline);
            
            _edName = _mainActivity.FindViewById<EditText>(Resource.Id.edGeneralName);
			_edNummer = _mainActivity.FindViewById<EditText> (Resource.Id.edNummer);
			_edStrasse = _mainActivity.FindViewById<EditText> (Resource.Id.edStrasse);
			_edPLZ = _mainActivity.FindViewById<EditText> (Resource.Id.edPLZ);
			_edOrt = _mainActivity.FindViewById<EditText> (Resource.Id.edOrt);
            _spinnerLand = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerLand);
			_edTelefon = _mainActivity.FindViewById<EditText> (Resource.Id.edTelefon);
			_edEmail = _mainActivity.FindViewById<EditText> (Resource.Id.edEmail);
			_edSearch = _mainActivity.FindViewById<EditText> (Resource.Id.edSearch);
            _edSperrdatum = _mainActivity.FindViewById<EditText>(Resource.Id.edSperrdatum);
            _edSperrgrund = _mainActivity.FindViewById<EditText>(Resource.Id.edSperrgrund);
            _btnClearSperrDatum = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnClearSperrDatum);
            _btnNew = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnNew);
            _btnEdit = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnEdit);
            _btnSave = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnSave);
            _btnDelete = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnDelete);
            _btnOffline = _mainActivity.FindViewById<ImageButton>(Resource.Id.btnOffline);


			_edName.Text = _stateClass._person.Name;
			_edName.Error = null;
			_edNummer.Text = _stateClass._person.Nummer;
			_edPLZ.Error = null;
			_edStrasse.Text = _stateClass._person.Strasse;
			_edPLZ.Text = _stateClass._person.PLZ;
			_edOrt.Text = _stateClass._person.Ort;
            if (_spinnerLand.Adapter != null)
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex (_stateClass._person.LandNummer));
			_edTelefon.Text = _stateClass._person.Telefon;
			_edEmail.Text = _stateClass._person.Email;
            _edSperrdatum.Text = _stateClass._person.Sperrdatum;
            _edSperrgrund.Text = _stateClass._person.Sperrgrund;

		}
        private async void Initialize()
        {
            try
            {
                // Get the paths to resources used by the sample.
                string basemapTilePath        = DataManager.GetDataFolder("567e14f3420d40c5a206e5c0284cf8fc", "streetmap_SD.tpk");
                string networkGeodatabasePath = DataManager.GetDataFolder("567e14f3420d40c5a206e5c0284cf8fc", "sandiego.geodatabase");

                // Create the tile cache representing the offline basemap.
                TileCache tiledBasemapCache = new TileCache(basemapTilePath);

                // Create a tiled layer to display the offline tiles.
                ArcGISTiledLayer offlineTiledLayer = new ArcGISTiledLayer(tiledBasemapCache);

                // Create a basemap based on the tile layer.
                Basemap offlineBasemap = new Basemap(offlineTiledLayer);

                // Create a new map with the offline basemap.
                Map theMap = new Map(offlineBasemap);

                // Set the initial viewpoint to show the routable area.
                theMap.InitialViewpoint = new Viewpoint(_routableArea);

                // Show the map in the map view.
                _myMapView.Map = theMap;

                // Create overlays for displaying the stops and the calculated route.
                _stopsOverlay = new GraphicsOverlay();
                _routeOverlay = new GraphicsOverlay();

                // Create a symbol and renderer for symbolizing the calculated route.
                SimpleLineSymbol routeSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.Blue, 2);
                _routeOverlay.Renderer = new SimpleRenderer(routeSymbol);

                // Add the stops and route overlays to the map.
                _myMapView.GraphicsOverlays.Add(_stopsOverlay);
                _myMapView.GraphicsOverlays.Add(_routeOverlay);

                // Create the route task, referring to the offline geodatabase with the street network.
                _offlineRouteTask = await RouteTask.CreateAsync(networkGeodatabasePath, "Streets_ND");

                // Get the list of available travel modes.
                _availableTravelModes = _offlineRouteTask.RouteTaskInfo.TravelModes.ToList();

                // Update the UI with the travel modes list.
                ArrayAdapter <string> spinnerListAdapter = new ArrayAdapter <string>(this,
                                                                                     Android.Resource.Layout.SimpleSpinnerItem, _availableTravelModes.Select(travelMode => travelMode.Name).ToArray());
                _travelModeSpinner.Adapter = spinnerListAdapter;
                _travelModeSpinner.SetSelection(0);

                // Create the default parameters.
                _offlineRouteParameters = await _offlineRouteTask.CreateDefaultParametersAsync();

                // Display the extent of the road network on the map.
                DisplayBoundaryMarker();

                // Now that the sample is ready, hook up the tapped and hover events.
                _myMapView.GeoViewTapped        += MapView_Tapped;
                _travelModeSpinner.ItemSelected += TravelMode_SelectionChanged;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                ShowMessage("Couldn't start sample", "There was a problem starting the sample. See debug output for details.");
            }
        }
Example #58
0
		public void Restore(MainActivity mainActivity)
		{

			// First refresh the mainActivity
			_mainActivity = mainActivity;


			AnsprechpartnerFragment fragment = new AnsprechpartnerFragment(Resource.Layout.FrgAnsprechpartner, _mainActivity , this);

			_mainActivity.FragmentManager 
				.BeginTransaction()
				.SetCustomAnimations (Android.Resource.Animator.FadeIn,Android.Resource.Animator.FadeOut)
				.Replace(Resource.Id.frameContent, fragment)
				.AddToBackStack (null)
				.Commit();

			// Then we have to get reference to the new controls
			var _btnNew = _mainActivity.FindViewById<ImageButton> (Resource.Id.btnNew);
			var _btnEdit = _mainActivity.FindViewById<ImageButton> (Resource.Id.btnEdit);
			var _btnSave = _mainActivity.FindViewById<ImageButton> (Resource.Id.btnSave);
			var _btnDelete = _mainActivity.FindViewById<ImageButton> (Resource.Id.btnDelete);
			var _btnOffline = _mainActivity.FindViewById<ImageButton> (Resource.Id.btnOffline);
			_edName = _mainActivity.FindViewById<EditText>(Resource.Id.edGeneralName);
			_edVorname = _mainActivity.FindViewById<EditText> (Resource.Id.edVorname);
			_edNummer = _mainActivity.FindViewById<EditText> (Resource.Id.edNummer);
			_edStrasse = _mainActivity.FindViewById<EditText> (Resource.Id.edStrasse);
			_edPLZ = _mainActivity.FindViewById<EditText> (Resource.Id.edPLZ);
			_edOrt = _mainActivity.FindViewById<EditText> (Resource.Id.edOrt);
            _spinnerLand = _mainActivity.FindViewById<Spinner>(Resource.Id.spinnerAnsprechpartnerLand);
			_edTelefon = _mainActivity.FindViewById<EditText> (Resource.Id.edTelefon);
			_edEmail = _mainActivity.FindViewById<EditText> (Resource.Id.edEmail);
			_edSearch = _mainActivity.FindViewById<EditText> (Resource.Id.edSearch);
            _tvEmail = _mainActivity.FindViewById<TextView>(Resource.Id.tvAnsprechpartnerEmail);
            _tvPhone = _mainActivity.FindViewById<TextView>(Resource.Id.tvAnsprechpartnerPhone);

            // Spinner einstellen
            if (_spinnerLand.Adapter != null)
            {
                if (_ansprechpartner != null)
                _spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex(_ansprechpartner.LandNummer));

            }

			// Set the status of the buttons
			_btnNew.Enabled = true;
			_btnEdit.Enabled = true;
			_btnSave.Enabled = false;
			_btnOffline.Enabled = true;
			_btnDelete.Enabled = true;


		}
Example #59
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            int doctorID = Intent.GetIntExtra("DoctorID", 0);
            //			if(doctorID > 0) {
                doctor = DoctorManager.GetDoctor(doctorID);
            //			}

            // set our layout to be the home screen
            SetContentView(Resource.Layout.DoctorDetails);

            SNameTextEdit   = FindViewById<EditText> (Resource.Id.txtSecondName);
            FNameTextEdit   = FindViewById<EditText> (Resource.Id.txtFirstName);
            TNameTextEdit   = FindViewById<EditText> (Resource.Id.txtThirdName);
            TelTextEdit     = FindViewById<EditText> (Resource.Id.txtTel);
            EmailTextEdit   = FindViewById<EditText> (Resource.Id.txtEmail);
            CabinetTextEdit = FindViewById<EditText> (Resource.Id.txtCabinet);

            SpecTextEdit  = FindViewById<AutoCompleteTextView> (Resource.Id.actxtSpeciality);
            ArrayAdapter SpecTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line, DoctorSpecialitys.GetSpecialitys());
            SpecTextEdit.Adapter = SpecTextEditAdapter;

            PosTextEdit   = FindViewById<AutoCompleteTextView> (Resource.Id.txtPosition);
            ArrayAdapter PosTextEditAdapter = new ArrayAdapter (this, Android.Resource.Layout.SimpleDropDownItem1Line,DoctorPositions.GetPositions() );
            PosTextEdit.Adapter = PosTextEditAdapter;

            saveButton = FindViewById<Button> (Resource.Id.btnSave);
            cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete);
            chIsDays = FindViewById<CheckBox> (Resource.Id.chIsDays);
            lstWorkTime = FindViewById<ListView> (Resource.Id.lstWorkTime);

            // set the cancel delete based on whether or not it's an existing task
            if(cancelDeleteButton != null)
            { cancelDeleteButton.Text = (doctor.ID == 0 ? "Отмена" : "Удалить"); }

            // SecondName
            if(SNameTextEdit != null) { SNameTextEdit.Text = doctor.SecondName; }

            // FirstName
            if(FNameTextEdit != null) { FNameTextEdit.Text = doctor.FirstName; }

            // ThirdName
            if(TNameTextEdit != null) { TNameTextEdit.Text = doctor.ThirdName; }

            // Telephone
            if(TelTextEdit != null) { TelTextEdit.Text = doctor.Tel; }

            // E-mail
            if(EmailTextEdit != null) { EmailTextEdit.Text = doctor.Email; }

            // Cabinet
            if(CabinetTextEdit != null) { CabinetTextEdit.Text = doctor.Cabinet; }

            // Speciality
            if(SpecTextEdit != null) { SpecTextEdit.Text = doctor.Speciality; }

            // Position
            if(PosTextEdit != null) { PosTextEdit.Text = doctor.Position; }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click += (sender, e) => { Save(); };

            workTimeItems = new List<Tuple<String, DateTime, WorkTime_Type, DateTime, WorkTime_Type>>();

            if (doctorID == 0) {
                chIsDays.Checked = true;
                doctor.wtKind = WorkTime_Kind.Days;
            } else {
                switch (doctor.wtKind) {
                case WorkTime_Kind.OddEven: { chIsDays.Checked = false; break; }
                case WorkTime_Kind.Days   : { chIsDays.Checked = true; break; }
                }
            }

            UpdateWorkTimeList();

            chIsDays.CheckedChange += (sender, e) => {
                if (chIsDays.Checked) { doctor.wtKind = WorkTime_Kind.Days; }
                else { doctor.wtKind = WorkTime_Kind.OddEven; }
                UpdateWorkTimeList();
            };

            /////////////////new code///////////////
            spnHospital = FindViewById<Spinner> (Resource.Id.spnHospital);
            hospitals = HospitalManager.GetHospitals();

            hospitalList = new Adapters.HospitalSpinnerAdapter(this, hospitals);
            spnHospital.Adapter = hospitalList;

            for (int i = 0; i < hospitals.Count; i++) {
                if (hospitals [i].ID == doctor.HospitalID) {
                    spnHospital.SetSelection (i + 1);
                }
            }

            spnHospital.ItemSelected += (sender, e) => {
                var s = sender as Spinner;
                if (e.Position == 0) {
                    doctor.HospitalID = -1;
                }
                else {
                    doctor.HospitalID = hospitals[e.Position - 1].ID;
                }
            };
            /////////////////new code///////////////
        }
Example #60
0
        void SetupView()
        {
            //Get UI Object Resources & Attach Them to Objects
            generatePasswordButton = FindViewById<Button> (Resource.Id.myButton);
            generatedPassword = FindViewById<EditText>(Resource.Id.generatedPasswordText);
            useUppercaseLettersCheckbox = FindViewById<CheckBox>(Resource.Id.useUppercaseLetters);
            useLowercaseLettersCheckbox = FindViewById<CheckBox>(Resource.Id.useLowercaseLetters);
            useNumbersCheckbox = FindViewById<CheckBox>(Resource.Id.useNumbers);
            useSpecialCharactersCheckbox = FindViewById<CheckBox>(Resource.Id.useSpecialCharacters);

            //Set Checkboxes to match default settings
            useUppercaseLettersCheckbox.Checked = true;
            useLowercaseLettersCheckbox.Checked = true;
            useNumbersCheckbox.Checked = true;
            useSpecialCharactersCheckbox.Checked = true;

            //Configure Spinner for Password Length Selection
            passwordLengthSpinner = FindViewById<Spinner>(Resource.Id.passwordLengthSpinner);
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.password_length_array, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            passwordLengthSpinner.Adapter = adapter;
            passwordLengthSpinner.SetSelection(3); //Set Length Spinner to show default length value

            //Event Handlers
            passwordLengthSpinner.ItemSelected += HandlePasswordLengthSpinnerItemSelected;
            useUppercaseLettersCheckbox.Click += HandleCheckboxClicked;
            useLowercaseLettersCheckbox.Click += HandleCheckboxClicked;
            useNumbersCheckbox.Click += HandleCheckboxClicked;
            useSpecialCharactersCheckbox.Click += HandleCheckboxClicked;

            generatePasswordButton.Click += delegate {
                generatedPassword.Text = generator.GeneratePassword(); };
        }