public void RunApplication()
 {
     MainForm.Shown += (o, e) =>
     {
         var mainForm = (Form)o;
         FormProgress.RunProcessWithProgress("Loading Controls...", MainForm, () => mainForm.Invoke(new MethodInvoker(() =>
         {
             InitControllers();
             Application.DoEvents();
             ShowTab(TabPageEnum.Reports);
         })));
     };
     Application.Run(MainForm);
 }
예제 #2
0
        public void LoadData(DateTime dateBegin, DateTime dateEnd)
        {
            gridControlData.DataSource = null;
            _data.Clear();

            var isSuccessful = false;

            FormProgress.RunProcessWithProgress("Loading Data...", MainController.Instance.MainForm, () =>
            {
                try
                {
                    var client  = new RestClient(MainController.SiteUrl);
                    var request = new RestRequest("activity/list", Method.GET);
                    request.AddParameter("dateBegin", dateBegin);
                    request.AddParameter("dateEnd", dateEnd);
                    var response = ResponeModel.Deserialize(client.Execute(request).Content);
                    isSuccessful = response.IsSuccess;
                    if (isSuccessful)
                    {
                        _data.AddRange(response.GetData <RawActivityModel[]>());
                    }
                }
                catch (Exception)
                {
                    isSuccessful = false;
                }
            });

            if (isSuccessful)
            {
                gridControlData.DataSource = _data;
                gridViewData.RefreshData();
            }
            else
            {
                MainController.Instance.PopupMessages.ShowWarning("Error occured while loading data");
            }
        }