Ejemplo n.º 1
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }
            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Load event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void BCMainForm_Load(object sender, EventArgs e)
        {
            try
            {
                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(callBackDoInitialize), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
#if DEBUG
                //openForm(typeof(OHT_Form).Name);
                if (SCUtility.isMatche(BCApp.SCApplication.BC_ID, "ASE_LOOP"))
                {
                    openForm(typeof(OHT_FormNew).Name, true, false);
                }
                else
                {
                    openForm(typeof(OHT_Form).Name);
                }
#endif
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, String.Format("Exception: {0}", ex));
                logger.Error(ex, "Exception");
            }
        }
Ejemplo n.º 3
0
        private static void ChangeDate()
        {
            var progress = new ProgressBarDialog(App.WMain, true, 1, "Change date");

            progress.AddEvents(
                Directory.GetFiles(@"d:\fotos", "*.jpg", SearchOption.AllDirectories),
                null,
                delegate(string path) {
                var fi    = new FileInfo(path);
                var match = Regex.Match(fi.Name, "[0-9]{8}_[0-9]{6}");
                if (match.Success && DateTime.TryParseExact(match.Value, "yyyyMMdd_HHmmss", CultureInfo.InvariantCulture,
                                                            DateTimeStyles.None, out var date))
                {
                    fi.LastWriteTime = date;
                    fi.CreationTime  = date;
                }
                else
                {
                    Console.WriteLine($"Date not recognized {path}");
                }
            },
                x => x,
                null);
            progress.StartDialog();
        }
Ejemplo n.º 4
0
 public bool FetchTransferProgressHandler(TransferProgress p)
 {
     ProgressBarDialog.MinorThreadSetCount(p.ReceivedObjects);
     ProgressBarDialog.MinorThreadSetTotal(p.TotalObjects);
     ProgressBarDialog.MinorThreadSetBytes(p.ReceivedBytes);
     return(true);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles the Click event of the stopConnectionToolStripMenuItem1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void stopConnectionToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CONNECTION_MANAGEMENT))
            {
                return;
            }
            try
            {
                DialogResult confirmResult = MessageBox.Show(this, BCApplication.getMessageString("Confirm_STOP_CONNECTING"),
                                                             BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);
                if (confirmResult != System.Windows.Forms.DialogResult.Yes)
                {
                    return;
                }

                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(
                    new System.Threading.WaitCallback(doStopConnection), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception:");
            }
        }
Ejemplo n.º 6
0
 public bool PushTransferProgressHandler(int current, int total, long bytes)
 {
     ProgressBarDialog.MinorThreadSetCount(current);
     ProgressBarDialog.MinorThreadSetTotal(total);
     ProgressBarDialog.MinorThreadSetBytes(bytes);
     return(true);
 }
Ejemplo n.º 7
0
        private async void GetData()
        {
            var dialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", Activity, false);

            try {
                dialog.Show();
                var dataMedicationSchedules = await networking.ReadFutureDataTask(0);

                Activity.RunOnUiThread(() =>
                {
                    Log.Error("MSF NetworkingData", "uiThread");
                    if (dataMedicationSchedules != null && dataMedicationSchedules.Count != 0)
                    {
                        _medications.Clear();
                        _medications = new List <MedicationSchedule>(dataMedicationSchedules);
                        _medicineServerAdapter.setMedsList(_medications);
                        _medicineServerAdapter.NotifyDataSetChanged();
                        cwEmpty.Visibility = _medicineServerAdapter.getList().Count == 0 ? ViewStates.Visible : ViewStates.Gone;
                    }
                    else
                    {
                        cwEmpty.Visibility = _medicineServerAdapter.getList().Count == 0 ? ViewStates.Visible : ViewStates.Gone;
                    }
                    dialog.Dismiss();
                });
            }
            catch (Exception e)
            {
                Log.Error("MedicationServerFragment", "FUTURE ERR " + e.Message);
                dialog.Dismiss();
            }
        }
Ejemplo n.º 8
0
            private void GetDiseaseList(object sender, EventArgs e)
            {
                var progressBarDialog = new ProgressBarDialog("Va rugam asteptati", "Se aduc date...", Activity, false);

                progressBarDialog.Show();
                Task.Run(async() =>
                {
                    string result = await WebServices.WebServices.Get(Constants.PublicServerAddress + "/api/getDisease", Utils.GetDefaults("Token"));
                    if (result == null)
                    {
                        return;
                    }

                    var arrayOfDiseases = new JSONArray(result);
                    var items           = new List <SearchListModel>();
                    for (var i = 0; i < arrayOfDiseases.Length(); i++)
                    {
                        var jsonModel = new JSONObject(arrayOfDiseases.Get(i).ToString());

                        items.Add(new SearchListModel
                        {
                            Id    = jsonModel.GetInt("cod"),
                            Title = jsonModel.GetString("denumire")
                        });
                    }

                    var intent = new Intent(Activity, typeof(SearchListActivity));
                    intent.PutExtra("Items", JsonConvert.SerializeObject(items));
                    intent.PutExtra("SelectedItems", JsonConvert.SerializeObject(_selectedDiseases));
                    StartActivityForResult(intent, 3);

                    Activity.RunOnUiThread(progressBarDialog.Dismiss);
                });
            }
Ejemplo n.º 9
0
 public void ObserveProgress(string message, Action action)
 {
     ProgressBarDialog = new ProgressBarDialog
     {
         Owner   = Application.Current.MainWindow,
         Message = message
     };
     action.BeginInvoke(CloseProgressBarDialog, null);
     ProgressBarDialog.ShowDialog();
     Wait.WaitOne();
 }
Ejemplo n.º 10
0
        public void Delete(MediaItemM[] items)
        {
            if (items.Length == 0)
            {
                return;
            }
            var progress = new ProgressBarDialog(App.WMain, false, 1, "Removing Media Items from database ...");

            progress.AddEvents(items, null, Model.Delete, mi => mi.FilePath, null);
            progress.StartDialog();
        }
Ejemplo n.º 11
0
        private async void SendData()
        {
            var dialog = new ProgressBarDialog("Va rugam asteptati", "Resetare...", this, false);

            dialog.Show();

            JSONObject dataToSent = new JSONObject().Put("email", _emailEditText.Text).Put("password", _passwordEditText.Text);
            string     res        = await WebServices.WebServices.Post(Constants.PublicServerAddress + "/api/passwordReset", dataToSent);

            if (res != null)
            {
                Log.Error("PwdResetActivity", res);

                try
                {
                    var response = new JSONObject(res);
                    Log.Error("Response", response.ToString());
                    switch (response.GetInt("status"))
                    {
                    case 0:
                        Snackbar.Make(_layout, "Email inexistent", Snackbar.LengthShort).Show();
                        break;

                    case 1:
                        Snackbar.Make(_layout, "Eroare de comunicare cu server-ul!", Snackbar.LengthShort).Show();
                        break;

                    case 2:
                        Snackbar.Make(_layout, "Un email de validare a fost trimis catre " + _emailEditText.Text, Snackbar.LengthShort).Show();
                        break;

                    default:
                        Snackbar.Make(_layout, "Eroare " + response, Snackbar.LengthShort).Show();
                        break;
                    }
                }
                catch (Exception e)
                {
                    var snack = Snackbar.Make(_layout, "Eroare " + e.Message, Snackbar.LengthShort);
                    snack.Show();
                }
            }
            else
            {
                Log.Error("PwdResetActivity", "res is null");
                var snack = Snackbar.Make(_layout, "Eroare preluare date de pe server", Snackbar.LengthShort);
                snack.Show();
            }

            RunOnUiThread(() =>
            {
                dialog.Dismiss();
            });
        }
        private void StartDicovery()
        {
            _progressBarDialog = new ProgressBarDialog("Va rugam asteptati", "Se cauta dispozitive...", this, false,
                                                       null, null, null, null, "Anulare", (sender, args) => Finish());
            _progressBarDialog.Show();

            _scanCallback.OnScanResultChanged += OnScanResult;

            _adapter            = new DevicesRecyclerViewAdapter();
            _adapter.ItemClick += async(sender, args) => {
                _bleDevicesRecords = await SqlHelper <BluetoothDeviceRecords> .CreateAsync();

                await _bleDevicesRecords.Insert(new BluetoothDeviceRecords {
                    Name       = _adapter.GetItem(args.Position).Name,
                    Address    = _adapter.GetItem(args.Position).Address,
                    DeviceType = DeviceType.BloodPressure
                });

                if (!Intent.GetBooleanExtra("RegisterOnly", false))
                {
                    StartActivity(typeof(BloodPressureDeviceActivity));
                }

                Finish();
            };

            _recyclerView = FindViewById <RecyclerView>(Resource.Id.addNewDeviceRecyclerView);
            _recyclerView.SetLayoutManager(new LinearLayoutManager(this));
            _recyclerView.SetAdapter(_adapter);

            var bluetoothManager = (BluetoothManager)GetSystemService(BluetoothService);

            if (bluetoothManager != null)
            {
                _bluetoothAdapter = bluetoothManager.Adapter;
            }

            if (_bluetoothAdapter == null)
            {
                Toast.MakeText(this, "Dispozitivul nu suporta Bluetooth Low Energy!", ToastLength.Short).Show();
                Finish();
            }
            else
            {
                if (!_bluetoothAdapter.IsEnabled)
                {
                    StartActivityForResult(new Intent(BluetoothAdapter.ActionRequestEnable), EnableBt);
                }
                else
                {
                    ScanDevices();
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Does the start connection.
        /// </summary>
        /// <param name="status">The status.</param>
        private void doStartConnection(object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            progress.Begin();
            progress.SetText(BCApplication.getMessageString("START_CONNECTING"));
            bcApp.startProcess();

            //Do something...

            progress.End();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Show a progress bar window while processes are running. Change the values with this.UpdateBarAndText.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="initialProgressBarValue">The value you want the progress bar to be at when the window opens.</param>
        /// <param name="initialProgressText">The text you want below the progress bar when the window opens.</param>
        /// <returns></returns>
        public static ProgressBarDialog ShowProgressBarDialog(string title, int initialProgressBarValue, string initialProgressText)
        {
            ProgressBarDialog progressBarDialog = new ProgressBarDialog
            {
                Title = title
            };

            progressBarDialog.ProgressBarField.Value = initialProgressBarValue;
            progressBarDialog.ProgressText.Text      = initialProgressText;
            progressBarDialog.Show();
            return(progressBarDialog);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Calls the back do initialize.
        /// </summary>
        /// <param name="status">The status.</param>
        private void callBackDoInitialize(Object status)
        {
            ProgressBarDialog progress = status as ProgressBarDialog;

            Adapter.Invoke(new SendOrPostCallback((o1) =>
            {
                progress.Begin();
                progress.SetText("Initialize...");
            }), null);
            bcApp = BCApplication.getInstance(ServerName);

            try
            {
                bcApp.addUserToolStripStatusLabel(tssl_LoginUser_Value);
                bcApp.addRefreshUIDisplayFun(delegate(object o) { UpdateUIDisplayByAuthority(); });
                bcApp.SCApplication.loadECDataToSystem();
                line = bcApp.SCApplication.getEQObjCacheManager().getLine();
                ci   = bcApp.SCApplication.getEQObjCacheManager().CommonInfo;

                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    registerEvent();
                    initUI();
                }), null);

                //必須等到UI Event註冊完成後,才可以開啟通訊界面
                //bcApp.startProcess();
                bcApp.SCApplication.ParkBLL.setCurrentParkType();
                bcApp.SCApplication.CycleBLL.setCurrentCycleType();
                //line.addEventHandler(this.Name
                //, BCFUtility.getPropertyName(() => line.ServiceMode)
                //, (s1, e1) => { bcApp.SCApplication.FailOverService.ListenOrShutdownServerPort(); });
            }
            catch (Exception ex)
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    MessageBox.Show(this, ex.ToString());
                }), null);
                logger.Error(ex, "Exception");
            }
            finally
            {
                Adapter.Invoke(new SendOrPostCallback((o1) =>
                {
                    if (progress != null)
                    {
                        progress.End();
                    }
                }), null);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Show a progress bar window while processes are running. Change the values with this.UpdateBarAndText.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="initialProgressBarValue">The value you want the progress bar to be at when the window opens.</param>
        /// <param name="initialProgressText">The text you want below the progress bar when the window opens.</param>
        /// <returns></returns>
        public static ProgressBarDialog ShowProgressBarDialog(string title, int initialProgressBarValue, string initialProgressText)
        {
            ProgressBarDialog progressBarDialog = new ProgressBarDialog
            {
                Title = title
            };

            progressBarDialog.ProgressBarField.Value = initialProgressBarValue;
            progressBarDialog.ProgressText.Text      = initialProgressText;
            progressBarDialog.Owner = Application.Current.MainWindow;
            progressBarDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            progressBarDialog.Show();
            return(progressBarDialog);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Handles the FormClosing event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void BCMainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO 確認Authority
            //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_MASTER_PC))
            //{
            //    //e.Cancel = true;
            //    //return;
            //}

            //1.初步詢問是否要關閉OHBC
            DialogResult confirmResult = MessageBox.Show(this, "Do you want to close OHTC?",
                                                         BCApplication.getMessageString("CONFIRM"), MessageBoxButtons.YesNo);

            recordAction("Do you want to close OHTC?", confirmResult.ToString());
            if (confirmResult != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
                return;
            }

            if (!SCUtility.isMatche(bcApp.SCApplication.BC_ID, "ASE_LOOP"))
            {
                if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CLOSE_SYSTEM, true))
                {
                    e.Cancel = true;
                    recordAction("Close Master PC, Authority Check...", "Failed !!");
                    return;
                }
            }
            recordAction("Close Master PC, Authority Check...", "Success !!");

            if (e.Cancel == false)
            {
                try
                {
                    ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                    System.Threading.ThreadPool.QueueUserWorkItem(
                        new System.Threading.WaitCallback(doStopConnection), progress);
                    if (progress != null && !progress.IsDisposed)
                    {
                        progress.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Exception");
                }
            }
        }
Ejemplo n.º 18
0
        private async void LoadDataReceived(View view)
        {
            try
            {
                var dialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", Activity, false);
                dialog.Show();
                // Initialize contacts
                List <SharingModel> contacts = null;
                await Task.Run(async() =>
                {
                    string response = await WebServices.WebServices.Post($"{Constants.PublicServerAddress}/api/getSharingPeople",
                                                                         new JSONObject().Put("email", Utils.GetDefaults("Email")),
                                                                         Utils.GetDefaults("Token"));
                    if (!string.IsNullOrEmpty(response))
                    {
                        Log.Error("ListaConexiuni", response);
                        contacts = JsonConvert.DeserializeObject <List <SharingModel> >(response);
                    }
                });

                if (contacts != null)
                {
                    var adapter = new SharingAdapter(contacts);
                    _sharingRecyclerViewReceived.SetAdapter(adapter);
                    _sharingRecyclerViewReceived.SetLayoutManager(new LinearLayoutManager(Activity));

                    adapter.ItemClick += delegate(object sender, SharingAdapterClickEventArgs args)
                    {
                        string name   = contacts[args.Position].Name;
                        string email  = contacts[args.Position].Email;
                        string imei   = contacts[args.Position].Imei;
                        var    intent = new Intent(Activity, typeof(SharingMenuActivity));
                        intent.PutExtra("Name", name);
                        intent.PutExtra("Email", email);
                        intent.PutExtra("Imei", imei);
                        StartActivity(intent);
                    };
                }

                Activity.RunOnUiThread(() =>
                {
                    dialog.Dismiss();
                });
            }
            catch (Exception e)
            {
                e.PrintStackTrace();
            }
        }
Ejemplo n.º 19
0
        private void IntiUi(View v)
        {
            _tbDetails        = v.FindViewById <EditText>(Resource.Id.input_details);
            _btnScan          = v.FindViewById <Button>(Resource.Id.btnScan);
            _btnAnulare       = v.FindViewById <Button>(Resource.Id.btnAnulare);
            _btnBloodPressure = v.FindViewById <Button>(Resource.Id.btnBloodPressure);

            _btnBloodGlucose = v.FindViewById <Button>(Resource.Id.btnBloodGlucose);

            _btnBenefits   = v.FindViewById <Button>(Resource.Id.benefits_button);
            _formContainer = v.FindViewById <ConstraintLayout>(Resource.Id.container);

            _progressBarDialog = new ProgressBarDialog("Va rugam asteptati", "Datele sunt procesate...", Activity, false);
            _progressBarDialog.Window.SetBackgroundDrawableResource(Resource.Color.colorPrimary);
        }
Ejemplo n.º 20
0
 private void InitUi()
 {
     FragmentContext       = this;
     _sectionsPagerAdapter = new SectionsPagerAdapter(SupportFragmentManager);
     _mainContent          = FindViewById <ConstraintLayout>(Resource.Id.main_content);
     _viewPager            = FindViewById <FirstSetupViewPager>(Resource.Id.container);
     _viewPager.SetPagingEnabled(false);
     _viewPager.Adapter = _sectionsPagerAdapter;
     _progressBarDialog =
         new ProgressBarDialog(
             "Va rugam asteptati",
             "Se trimit datele",
             this, false);
     _progressBarDialog.Window.SetBackgroundDrawableResource(Resource.Color.colorPrimaryDark);
 }
Ejemplo n.º 21
0
        /// <summary>
        /// This method is executed when the user wants to play a media from an URI source.
        /// </summary>
        /// <param name="sender">The sender object's instance</param>
        /// <param name="e">Event parameters</param>
        private async void UriOpen_Click(object sender, MouseButtonEventArgs e)
        {
            this.viewModel.MenuVisible = false;

            #region Check requirements
            if (!YoutubePlayback.ToolsAvailable)
            {
                MessageBoxResult DownloadQuestion = MessageBox.Show(
                    messageBoxText: "Első alkalommal le kell tölteni az ffmpeg.exe, az ffprobe.exe és a youtube-dl.exe programokat. Szeretnéd most letölteni?",
                    caption: "Kellene még néhány dolog...",
                    button: MessageBoxButton.YesNo,
                    icon: MessageBoxImage.Question
                    );

                if (DownloadQuestion == MessageBoxResult.Yes)
                {
                    ProgressBarDialog ProgressBar = new ProgressBarDialog("YouTube eszközök letöltése", "Fél perc és kész vagyunk...");
                    ProgressBar.Show();

                    await YoutubePlayback.DownloadSoftwareAsync();

                    ProgressBar.Close();
                }
                else
                {
                    return;
                }
            }
            #endregion

            TextInputDialog Dialog = new TextInputDialog("YouTube média letöltése", "Írd ide a videó címét, amit meg szeretnél nyitni:");
            Dialog.Owner = this;

            bool?Result = Dialog.ShowDialog();
            if (Result.HasValue && Result.Value == true)
            {
                if (!YoutubeUri.IsValidYoutubeUri(Dialog.UserInput))
                {
                    PlayerUtils.ErrorMessageBox(App.Name, "Úgy tűnik, hibás linket adtál meg.");
                    return;
                }

                await this.OpenFilesAsync(new string[] { Dialog.UserInput });
            }
        }
Ejemplo n.º 22
0
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            if (requestCode == 1)
            {
                if (resultCode == Result.Ok)
                {
                    var dialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", this, false);
                    dialog.Show();

                    Log.Error("ProfileActivity", "birthdate: get string extra " + data.GetStringExtra("birthdate"));

                    personalData = await ProfileStorage.GetInstance().read();
                    await RefreshAdapter();

                    if (await CallServerToSendData(personalData.Base64Image,
                                                   personalData.ImageName,
                                                   data.GetStringExtra("name"),
                                                   data.GetStringExtra("birthdate"),
                                                   data.GetStringExtra("gender"),
                                                   personalData.listOfPersonalDiseases))
                    {
                        LoadModelInView(Utils.GetDefaults("Avatar"),
                                        data.GetStringExtra("name"),
                                        Utils.GetDefaults("Email"),
                                        data.GetStringExtra("gender"),
                                        data.GetStringExtra("birthdate"),
                                        true);

                        Utils.SetDefaults("Name", data.GetStringExtra("name"));
                    }
                    else
                    {
                        Toast.MakeText(this, "S-a intampinat o eroare la salvarea datelor.", ToastLength.Long).Show();
                    }

                    RunOnUiThread(() => dialog.Dismiss());
                }

                if (resultCode == Result.Canceled)
                {
                    Log.Error("ProfileActivity", "cancel update");
                }
            }
        }
Ejemplo n.º 23
0
        private async Task <List <Category> > GetCategories()
        {
            var dialog     = new ProgressBarDialog("Asteptati", "Se preiau datele", this, false);
            var categories = new List <Category>();

            try
            {
                dialog.Show();
                string res = await WebServices.WebServices.Get($"{Constants.PublicServerAddress}/api/gamesCategories/", Utils.GetDefaults("Token"));

                if (res != null)
                {
                    Log.Error(LOG_TAG, " RESULT " + res);
                    try {
                        var array = new JSONArray(res);
                        for (var i = 0; i < array.Length(); i++)
                        {
                            var obj = (JSONObject)array.Get(i);
                            categories.Add(new Category(obj.GetInt("id"), obj.GetString("categorie")));
                        }
                    } catch (Exception e) {
                        Log.Error(LOG_TAG, "ERR" + e.Message);
                    }
                }
                else
                {
                    Log.Error(LOG_TAG, " Res is null");
                }

                RunOnUiThread(() =>
                {
                    Log.Error(LOG_TAG, "uiThread");
                    dialog.Dismiss();
                });
            }
            catch (Exception e)
            {
                Log.Error(LOG_TAG, "ERR " + e.Message);
                dialog.Dismiss();
            }

            return(categories);
        }
        private async void LoadSelectDiseaseActivity()
        {
            var progressBarDialog = new ProgressBarDialog("Va rugam asteptati", "Se aduc date...", this, false);

            progressBarDialog.Show();
            var list = new List <SearchListModel>();

            if (listToBeSaved != null)
            {
                Log.Error("UpdateProfileActivity", "diseases count: " + listToBeSaved.Count);
                foreach (PersonalDisease element in listToBeSaved)
                {
                    var slm = new SearchListModel();
                    slm.Id         = element.Cod;
                    slm.Title      = element.Name;
                    slm.IsSelected = true;
                    list.Add(slm);
                }
            }
            else
            {
                if (personalData.listOfPersonalDiseases.Count != 0)
                {
                    Log.Error("UpdateProfileActivity", "diseases count: " + personalData.listOfPersonalDiseases.Count);
                    foreach (PersonalDisease element in personalData.listOfPersonalDiseases)
                    {
                        var slm = new SearchListModel();
                        slm.Id         = element.Cod;
                        slm.Title      = element.Name;
                        slm.IsSelected = true;
                        list.Add(slm);
                    }
                }
            }

            var intent = new Intent(this, typeof(SearchListActivity));

            intent.PutExtra("Items", JsonConvert.SerializeObject(await GetDiseaseList()));
            intent.PutExtra("SelectedItems", JsonConvert.SerializeObject(list));
            StartActivityForResult(intent, 3);
            RunOnUiThread(() => progressBarDialog.Dismiss());
        }
Ejemplo n.º 25
0
        private void OnClickSave(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure? Will take a while", "Save", MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result != DialogResult.Yes)
            {
                return;
            }

            ProgressBarDialog barDialog = new ProgressBarDialog(Art.GetIdxLength(), "Save");

            Cursor.Current = Cursors.WaitCursor;
            Art.Save(Options.OutputPath);
            barDialog.Dispose();
            Cursor.Current = Cursors.Default;
            Options.ChangedUltimaClass["Art"] = false;
            MessageBox.Show($"Saved to {Options.OutputPath}", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information,
                            MessageBoxDefaultButton.Button1);
        }
Ejemplo n.º 26
0
        public void ImportLevel()
        {
            XmlDocument doc = null;

            FormImportLevel formImportLevel = new FormImportLevel();

            if (formImportLevel.ShowDialog() == DialogResult.OK)
            {
                doc = formImportLevel.doc;
            }

            if (doc != null)
            {
                ProgressBarDialog progressBarDialog = new ProgressBarDialog();
                XmlParser         xmlParser         = new XmlParser(true);
                xmlParser.ParseMap(doc, ref progressBarDialog);
            }

            formImportLevel.Dispose();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Handles the Load event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void BCMainForm_Load(object sender, EventArgs e)
        {
            try
            {
                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(callBackDoInitialize), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
#if DEBUG
                openForm(typeof(OHT_Form).Name);
#endif
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, String.Format("Exception: {0}", ex));
                logger.Error(ex, "Exception");
            }
        }
Ejemplo n.º 28
0
        public async void LoadModel(bool updated)
        {
            var dialog = new ProgressBarDialog("Asteptati", "Se incarca datele...", this, false);

            dialog.Show();
            PersonView person = await CallServerToGetData();

            var adapter = new DiseasesAdapter(this);

            if (person != null)
            {
                LoadModelInView(person.Avatar, person.Name, person.Email, person.Gender, person.Birthdate, updated);
                adapter = new DiseasesAdapter(this, person.ListOfPersonalDiseases);
            }
            else
            {
                personalData = await ProfileStorage.GetInstance().read();

                if (personalData == null)
                {
                    Log.Error("ProfileActivity", "data from db is null");
                    Toast.MakeText(this, "Nu există date despre profilul dumneavoastră. Incercați să vă reautentificați.", ToastLength.Long);
                }
                else
                {
                    LoadModelInView(Utils.GetDefaults("Avatar"), Utils.GetDefaults("Name"), Utils.GetDefaults("Email"), personalData.Gender, personalData.DateOfBirth, updated);
                    adapter = new DiseasesAdapter(this, personalData.listOfPersonalDiseases);
                }
            }

            FindViewById <TextView>(Resource.Id.tv_empty).Visibility = adapter.ItemCount == 0
                ? ViewStates.Visible
                : ViewStates.Gone;

            rv.SetAdapter(adapter);
            adapter.NotifyDataSetChanged();



            RunOnUiThread(() => dialog.Dismiss());
        }
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        public PatchVersionSelectionViewModel(Window parentWindow, UserControl control) : base(parentWindow)
        {
            Patches patches = new Patches();

            AllPatches = patches.GetPatches();

            IProgressCommand  downloadPatchesCommand = new DownloadAllPatchesCommand(settingManager);
            ProgressBarDialog dialog = new ProgressBarDialog();

            if (dialog.DataContext is ProgressBarDialogViewModel progressViewModel)
            {
                downloadPatchesCommand.ProgressChanged += (sender, data) =>
                {
                    progressViewModel.UpdateProgress(data.CurrentWorkload, data.TotalWorkload);
                };
                downloadPatchesCommand.Executed += (sender, data) =>
                {
                    progressViewModel.UpdateProgress(100, 100);
                };
            }
            DownloadAllPatches = new MultiCommand(new List <ICommand>()
            {
                downloadPatchesCommand,
                new OpenCustomPopupWindowCommand(currentWindow, FontAwesomeIcon.Hourglass, "Downloading all patches", dialog, false, null)
            });

            object dockArea = control.FindName("DP_InnerDock");

            object controllerDock = control.FindName("IC_PatchSelectionControl");

            if (dockArea is DockPanel panel && controllerDock is ItemsControl controller)
            {
                panelToUse            = panel;
                OpenLaunchGameCommand = new OpenLaunchUserControlToPanel(
                    panelToUse,
                    new LaunchGameUserControl(parentWindow),
                    controller
                    );
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Handles the Click event of the startConnectionToolStripMenuItem1 control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void startConnectionToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     //if (!BCUtility.doLogin(this, bcApp, BCAppConstants.FUNC_CONNECTION_MANAGEMENT))
     //{
     //    return;
     //}
     try
     {
         ProgressBarDialog progress = new ProgressBarDialog(bcApp);
         System.Threading.ThreadPool.QueueUserWorkItem(
             new System.Threading.WaitCallback(doStartConnection), progress);
         if (progress != null && !progress.IsDisposed)
         {
             progress.ShowDialog();
         }
         return;
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception:");
     }
 }