public override async void ViewDidLoad() { base.ViewDidLoad(); TopMenuEvents(true, btnMonth, btnQuarter, btnHalfYear, btnYear); ClickServicesEvents(true, btnCost, btnQuality, btnService, btnAll); btnCost.TouchUpInside += btnOneTouch; btnQuality.TouchUpInside += btnTwoTouch; btnService.TouchUpInside += btnThreeTouch; btnAll.TouchUpInside += btnFourTouch; HttpServiceConn conn = new HttpServiceConn(); try { _Questions = await conn.GetQuestions(Token, Company); CreateButtonForGraphics(btnCost, btnQuality, btnService, btnAll); } catch (Exception ex) { UIAlertView error = new UIAlertView("Ошибка", ex.Message, null, "Закрыть", null); error.Show(); } btnMonth.SendActionForControlEvents(UIControlEvent.TouchUpInside); UISwipeGestureRecognizer gest = new UISwipeGestureRecognizer(); gest.Direction = UISwipeGestureRecognizerDirection.Right; gest.AddTarget(() => MoveBack(gest)); MainBackGroubd.AddGestureRecognizer(gest); }
async void tableWork(object sender, EventArgs e) { HttpServiceConn conn = new HttpServiceConn(); loadingOverlay = new LoadingOverlay(new CGRect(MainBackground.Frame.X, MainBackground.Frame.Y, MainBackground.Frame.Width, MainBackground.Frame.Height - BottomMenu.Frame.Height)); Add(loadingOverlay); var rate = await conn.GetRating(GraphicsController.Token); List <string> data = new List <string> (); foreach (var item in rate.Item2.Resource) { data.Add(item.Value); } for (int i = 0; i < data.Count; i++) { if (data [i].ToUpper().Contains("Моя компания".ToUpper())) { index = i + 1; } } this.NavigationItem.Title = string.Format("Ваш рейтинг: {0} из {1}", index, data.Count); table.Bounces = true; table.Source = new RateTableSourceFill(data); Add(table); Add(loadingOverlay); loadingOverlay.Hide(); }
async void tableWork(object sender, EventArgs e) { HttpServiceConn conn = new HttpServiceConn(); loadingOverlay = new LoadingOverlay(new CGRect(MainBackgroundComp.Frame.X, MainBackgroundComp.Frame.Y, MainBackgroundComp.Frame.Width, MainBackgroundComp.Frame.Height)); Add(loadingOverlay); var rate = await conn.GetCompanies(GraphicsController.Token); table.Bounces = true; table.Source = new CompaniesTableFill(rate.Item2.Resource, this); Add(table); Add(loadingOverlay); loadingOverlay.Hide(); }
async void tableWork(object sender, EventArgs e) { HttpServiceConn conn = new HttpServiceConn(); loadingOverlay = new LoadingOverlay(new CGRect(MainBackground.Frame.X, MainBackground.Layer.Frame.Y, MainBackground.Frame.Width, MainBackground.Layer.Frame.Height - BottomMenu.Layer.Frame.Height)); Add(loadingOverlay); data = await conn.GetComments(GraphicsController.Token, DateTime.Now.ToString("ddMMyyyy")); table.Bounces = true; table.Source = new CommentsTableSourceFill(data.Item2.Resource, this); Add(table); Add(loadingOverlay); loadingOverlay.Hide(); }
async void btnLoginTouchUpInside(Object sender, EventArgs e) { btnLogin.Enabled = false; if (txtPassword.Text.ToUpper() == "" || txtLogin.Text.ToUpper() == "") { UIAlertView error = new UIAlertView("Ошибка", "Введите пожалуйста логин или пароль.", null, "Закрыть", null); error.Show(); btnLogin.Enabled = true; } else { HttpServiceConn newconn = new HttpServiceConn(); string md5hash = md5securitycobject.ComputeHash(txtLogin.Text + txtPassword.Text); loadingOverlay = new LoadingOverlay(new System.Drawing.RectangleF(0, 0, 320, 568)); View.Add(loadingOverlay); data = await newconn.WebRequestServiceAsync(md5hash, txtLogin.Text, txtPassword.Text); loadingOverlay.Hide(); try { if ((string.IsNullOrWhiteSpace(data.Item1)) && data != null) { ServiceCallBack(data.Item2); } else { btnLogin.Enabled = true; if (data.Item2.Status == "error") { if (data.Item2.Error != null) { UIAlertView error = new UIAlertView("Ошибка", data.Item2.Error.ErrorDescription, null, "Закрыть", null); error.Show(); } else { if (data.Item1 != null && data.Item1.Contains("ConnectFailure")) { UIAlertView error = new UIAlertView("Ошибка", "Пожалуйста проверьте ваше интернет-соединение.", null, "Закрыть", null); error.Show(); } else { if (!string.IsNullOrWhiteSpace(data.Item1)) { UIAlertView error = new UIAlertView("Ошибка", data.Item1, null, "Закрыть", null); error.Show(); } } } } else { if (data.Item1 != null && data.Item1.Contains("ConnectFailure")) { UIAlertView error = new UIAlertView("Ошибка", "Пожалуйста проверьте ваше интернет-соединение.", null, "Закрыть", null); error.Show(); } else { UIAlertView error = new UIAlertView("Ошибка", "Пожалуйста обратитесь к администратору.", null, "Закрыть", null); error.Show(); } } } } catch (Exception ex) { UIAlertView error = new UIAlertView("Ошибка", ex.Message, null, "Закрыть", null); error.Show(); } } }
async void btnTopMenuTouch(object sender, EventArgs e) { if (osXview != null) { osXview.RemoveFromSuperview(); } UIButton but = sender as UIButton; HttpServiceConn conn = new HttpServiceConn(); if (_buttonAllCliked) { _all.DeleteTouchView(); _all.RemoveFromSuperview(); } if (_buttonCostCliked) { _cost.DeleteTouchView(); _cost.RemoveFromSuperview(); } if (_buttonQualityCliked) { _quality.DeleteTouchView(); _quality.RemoveFromSuperview(); } if (_buttonServiceCliked) { _service.DeleteTouchView(); _service.RemoveFromSuperview(); } loadingOverlay = new LoadingOverlay(new CGRect(MainBackGroubd.Frame.X, MainBackGroubd.Layer.Frame.Y, MainBackGroubd.Frame.Width, MainBackGroubd.Layer.Frame.Height - BottomMenu.Layer.Frame.Height)); View.Add(loadingOverlay); _data = await conn.GetGraphicAsync(Token, DateTime.Now.ToString("dd.MM.yyyy"), but.Title(UIControlState.Normal)); loadingOverlay.Hide(); if (_data != null) { if (_data.Item2.Resource != null) { CreateOsXMonthOrDaysVector(_data.Item2.Resource); _buttonCostCliked = true; but.Enabled = false; if (UIControlState.Disabled == but.State) { but.TitleEdgeInsets = new UIEdgeInsets(0, -46, 0, 0); } if (_but == null) { _but = but; } else { _but.Enabled = true; if (UIControlState.Normal == _but.State) { _but.TitleEdgeInsets = new UIEdgeInsets(0, 0, 0, 0); } _but = but; } if (_buttonCostCliked) { _buttonCostCliked = false; btnCost.SendActionForControlEvents(UIControlEvent.TouchUpInside); } if (_buttonQualityCliked) { _buttonQualityCliked = false; btnQuality.SendActionForControlEvents(UIControlEvent.TouchUpInside); } if (_buttonServiceCliked) { _buttonServiceCliked = false; btnService.SendActionForControlEvents(UIControlEvent.TouchUpInside); } if (_buttonAllCliked) { _buttonAllCliked = false; btnAll.SendActionForControlEvents(UIControlEvent.TouchUpInside); } } else { UIAlertView error = new UIAlertView("Ошибка", _data.Item1, null, "Закрыть", null); error.Show(); } } }