private static void InstallMultiMinerLocally() { ProgressForm progressForm = new ProgressForm("Downloading and installing MultiMiner from " + Engine.Installers.MultiMinerInstaller.GetMinerDownloadRoot()); progressForm.Show(); //for Mono - show the UI System.Windows.Forms.Application.DoEvents(); Thread.Sleep(25); System.Windows.Forms.Application.DoEvents(); try { MultiMiner.Engine.Installers.MultiMinerInstaller.InstallMiner(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)); } finally { progressForm.Close(); } }
private void ScanHardwareLocally() { if (miningEngine.Mining) return; ProgressForm progressForm = new ProgressForm("Scanning hardware for devices capable of mining. Please be patient."); updatingListView = true; try { progressForm.IsDownload = false; //not ShowDialog() progressForm.Show(); try { using (new HourGlass()) { DevicesService devicesService = new DevicesService(engineConfiguration.XgminerConfiguration); MinerDescriptor defaultMiner = MinerFactory.Instance.GetDefaultMiner(); devices = devicesService.GetDevices(defaultMiner, MinerPath.GetPathToInstalledMiner(defaultMiner)); //safe to do here as we are Scanning Hardware - we are not mining //no data to lose in the ViewModel //clearing means our sort order within the ListView is preserved //and things like selecting the first item work better //http://social.msdn.microsoft.com/Forums/windows/en-US/8a81c5a6-251c-4bf9-91c5-a937b5cfe9f3/possible-bug-in-listview-control-topitem-property-doesnt-work-with-groups localViewModel.Devices.Clear(); ApplyModelsToViewModel(); //populate ListView directly after - maintain 1-to-1 for ViewModel to ListView items RefreshListViewFromViewModel(); } } catch (Win32Exception) { //miner not installed/not launched devices = new List<Xgminer.Data.Device>(); //dummy empty device list ShowNotInstalledMinerWarning(); } if ((devices.Count > 0) && (engineConfiguration.DeviceConfigurations.Count == 0) && (engineConfiguration.CoinConfigurations.Count == 1)) { //setup devices for a brand new user ConfigureDevicesForNewUser(); } //first try to match up devices without configurations with configurations without devices //could happen if, for instance, a COM port changes for a device FixOrphanedDeviceConfigurations(); //there needs to be a device config for each device AddMissingDeviceConfigurations(); //but no configurations for devices that have gone missing RemoveExcessDeviceConfigurations(); //remove any duplicate configurations engineConfiguration.RemoveDuplicateDeviceConfigurations(); RefreshListViewFromViewModel(); RefreshDetailsAreaIfVisible(); //clean up mappings from previous device list deviceDetailsMapping.Clear(); //auto-size columns AutoSizeListViewColumns(); RefreshStatusBarFromViewModel(); //it may not be possible to mine after discovering devices UpdateMiningButtons(); //cache devices SaveKnownDevicesToFile(); } finally { updatingListView = false; progressForm.Close(); progressForm.Dispose(); } }
private void InstallBackendMinerLocally(MinerDescriptor miner) { string minerName = miner.Name; ProgressForm progressForm = new ProgressForm(String.Format("Downloading and installing {0} from {1}", minerName, new Uri(miner.Url).Authority)); progressForm.Show(); //for Mono - show the UI System.Windows.Forms.Application.DoEvents(); Thread.Sleep(25); System.Windows.Forms.Application.DoEvents(); try { string minerPath = Path.Combine("Miners", minerName); string destinationFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, minerPath); MinerInstaller.InstallMiner(UserAgent.AgentString, miner, destinationFolder); //may have been installed via Remoting - dismiss notification notificationsControl.RemoveNotification(bfgminerNotificationId.ToString()); } finally { progressForm.Close(); } }