public MainViewModel() { this.CurrentNum = 0; this.DataCells = new BindableCollection <DataCell>(); TaskThradManagement = new ThreadManagement(MaxThreadNum); TaskThradManagement.UploadCompontentComplatedEvent += OnUploadCompontentComplatedEvent; }
private async void OnFolderSelected() { var selectedFolder = await FileAccess.PickFolder(); FolderMessage = "*****Great you selected a folder. Now I have to do some work to import them. Please hang on a minute, I promise not to take too long.***"; ThreadManagement.ExecuteInSeparateThread(ReapComics, selectedFolder); }
public ThreadManagement CreateThreadManagement() { var cts = new CancellationTokenSource(); progressMessageQueue = new BlockingCollection <ThreadManagement.progressMessage>(new ConcurrentQueue <ThreadManagement.progressMessage>()); var totalNumberOfSpectra = _source._spectra.Count; Task.Factory.StartNew(() => { try { ThreadManagement.progressMessage msg; double lastProgress; lastProgress = -1; while (!progressMessageQueue.IsCompleted) { msg = progressMessageQueue.Take(); if (msg.type == ThreadManagement.progressMessage.typeOfMessage.stringMessage) { if (msg.message != null) { // Console.WriteLine(msg.message); } } else { var currentProgress = msg.spectraProcessed / totalNumberOfSpectra; if (currentProgress >= lastProgress + 0.001) { lastProgress = currentProgress; // Console.Write(lastProgress * 100); } } } } catch { } }); var phosphoRS3 = new ThreadManagement( this, m_searchCancel: cts, maxIsoformCount: _source._options.MaxIsoformCount, maxPTMCount: _source._options.MaxPTMCount, scoreNLPeaksToo: _source._options.ScoreNeutralLoss.ToString(), masstolerance: _source._options.MassTolerance, ptmAminoAcidModification: _source._phosphoModification, totalNumberOfSpectra: totalNumberOfSpectra ); return(phosphoRS3); }
/// <summary> /// This will create a main thread manager if one is not already created /// </summary> public static void Create() { if (_instance != null) { return; } ThreadManagement.Initialize(); if (!ReferenceEquals(_instance, null)) { return; } new GameObject("Main Thread Manager").AddComponent <MainThreadManager>(); }
protected BaseViewModel(MessengerService messengerService, ThreadManagement threadManagement) { MessengerService = messengerService; ThreadManagement = threadManagement; RegisterForMessages(); if (IsInDesignModeStatic) { OnDesignTime(); } else { ThreadManagement.ExecuteInSeparateThread(RunStartUp); } }
public ImportComicViewModel(MessengerService messengerService, ThreadManagement threadManagement, SelectedComicsBusiness selectedComicsBusiness, FileAccess fileAccess) : base(messengerService, threadManagement) { SelectedComicsBusiness = selectedComicsBusiness; FileAccess = fileAccess; }
public MainViewModel(MessengerService messengerService, ThreadManagement threadManagement, SelectedComicsBusiness selectedComicsBusiness) : base(messengerService, threadManagement) { SelectedComicsBusiness = selectedComicsBusiness; }