Exemple #1
0
        private async void Form_Main_Shown(object sender, EventArgs e)
        {
            //// TODO temporary hooks
            ApplicationStateManager._ratesComunication = devicesListViewEnableControl1;
            // handle these callbacks differently
            //NiceHashStats.OnConnectionLost += ConnectionLostCallback;
            ApplicationStateManager.OnExchangeUpdate += UpdateExchange;

            foreach (Control c in Controls)
            {
                c.Enabled = false;
            }

            using (var loadingControl = new StartupLoadingControl(Tr("Loading, please wait...")))
            {
                Controls.Add(loadingControl);
                var location = new Point((Width - loadingControl.Width) / 2, (int)((Height - loadingControl.Height) * 0.3));
                loadingControl.Location = location;
                loadingControl.BringToFront();

                var progress = new Progress <(string loadMessageText, int perc)>(p =>
                {
                    loadingControl.Progress        = (int)p.perc;
                    loadingControl.LoadMessageText = p.loadMessageText;
                });

                var progressDownload = new Progress <(string loadMessageText, int perc)>(p =>
                {
                    loadingControl.ProgressSecond        = (int)p.perc;
                    loadingControl.LoadMessageTextSecond = p.loadMessageText;
                });
                await ApplicationStateManager.InitializeManagersAndMiners(loadingControl);
            }
            devicesListViewEnableControl1.SetComputeDevices(AvailableDevices.Devices.ToList());

            foreach (Control c in Controls)
            {
                c.Enabled = true;
            }

            // Data bindings
            InitDataBindings();
            textBoxBTCAddress_Validate();
            textBoxWorkerName_Validate();

            if (ConfigManager.GeneralConfig.AutoStartMining)
            {
                // well this is started manually as we want it to start at runtime
                _isManuallyStarted = true;
                if (StartMining(false) != StartMiningReturnType.StartMining)
                {
                    _isManuallyStarted = false;
                    ApplicationStateManager.StopAllDevice();
                }
            }
#if SHOW_TDP_SETTINGS
            var form_TDP = new Form_TDPSettings();
            form_TDP.Show();
#endif
        }
Exemple #2
0
 public static async Task InitializeManagersAndMiners(StartupLoadingControl loadingControl, IProgress <(string loadMessageText, int prog)> progress, IProgress <(string loadMessageText, int prog)> progressDownload)