private IEnumerator LoadWWWData(string path, LoadDataCallback callback) { var request = new WWW(path.StartsWith("jar:")?path:"file:///" + path); while (!request.isDone) { if (string.IsNullOrEmpty(request.error)) { yield return(null); } else { break; } } if (string.IsNullOrEmpty(request.error)) { if (callback != null) { callback(0, request.bytes); } } else { if (callback != null) { Debug.LogErrorFormat("LoadWWWData {0} error with {1}", path, request.error); callback(-1, null); } } }
private void LoadData() { if (this.UltraGrid1.InvokeRequired == true) { LoadDataCallback aDelegate = new LoadDataCallback(LoadData); Invoke(aDelegate); } else { this.UltraGrid1.DataSource = Globals.dtFiles; if (Globals.dtFiles.Rows.Count == 0) { MessageBox.Show("No duplicates where found during the search.", "No Duplicates Found", MessageBoxButtons.OK); } if (Globals.SearchType == "Byte") { this.UltraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("UID", false, true); } else { this.UltraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("FileName2", false, true); } this.UltraGrid1.DisplayLayout.Bands[0].Override.GroupByRowDescriptionMask = "This group contains [count] duplicate files"; ExpandGrid(); } }
/// <summary> /// 非同步讀取資料請求結構內的 Instrument 資料 /// </summary> /// <param name="request">資料請求結構</param> /// <param name="result">當成功取得 Instrument 商品資料會使用此委派方法回傳資料</param> /// <param name="useCache">是否使用快取 [預設:false](true=序列資料結構建立後保存在快取內,下次需要使用直接從快取拿取, false=重新建立序列資料結構,建立的序列資料需要自行移除否則會占用記憶體空間)</param> /// <param name="args">使用者自訂參數</param> /// <param name="millisecondsTimeout">回補資料 Timeout 毫秒數 [預設:System.Threading.Timeout.Infinite (永遠等待直到回補完成)]</param> public void BeginLoadData(InstrumentDataRequest request, LoadDataCallback result, bool useCache = false, object args = null, int millisecondsTimeout = System.Threading.Timeout.Infinite) { SeriesManager.Manager.SetQuoteService(request.DataFeed); SeriesManager.Manager.AsyncGetSeries(request, (object sender, SeriesResultEvent e) => { SeriesSymbolDataRand cSeriesSymbolDataRand = e.Data; cSeriesSymbolDataRand.SetMaxbarsReferance(__iMaxBarsReference); Instrument cInstrument = new Instrument(cSeriesSymbolDataRand); //建立 Instrument 商品資料 Instrument cBars_0 = GetInstrument(0); //取得目前第 0 個 Instrument 商品資料 if (cBars_0 != null) { cInstrument.MoveBars(cBars_0.Time.Value); } result(new DataLoaderResult(cInstrument, cInstrument.Quotes, args)); }, useCache, null, millisecondsTimeout); }
public virtual void LoadData(string path, LoadDataCallback callback) { StartCoroutine(LoadWWWData(path, callback)); }
/// <summary> /// Load the data /// </summary> /// <param name="mot">The mot.</param> /// <param name="name">The name.</param> private void _LoadData(MovieObjectType mot, string name) { if (this.dgvPersons.InvokeRequired) { LoadDataCallback ldCall = new LoadDataCallback(_LoadData); this.Invoke(ldCall, new object[] { mot, name }); } else { this.Cursor = Cursors.WaitCursor; if (__useDataBind) { this.dgvPersons.DataSource = null; } else { this.dgvPersons.Rows.Clear(); } name = name.Replace("'", "´"); List <Person> list = this._db.GetPersonList( mot, name, this._sortExpression, (this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending) ); //PersonCollection list = this._db.GetPersonList(mot, name); //list.Sort((IComparer<Person>)new Person.SortByFirstname()); this._currentAmount = list.Count; int count = 0; if (__useDataBind) { this.dgvPersons.AutoGenerateColumns = false; this.dgvPersons.DataSource = list; } else { foreach (Person p in list) { this.dgvPersons.Rows.Add(1); this.dgvPersons.Rows[count].Cells[0].Value = p.ID; this.dgvPersons.Rows[count].Cells[1].Value = p.Firstname + " " + p.Lastname; this.dgvPersons.Rows[count].Cells[2].Value = p.IsActor; this.dgvPersons.Rows[count].Cells[3].Value = p.IsDirector; this.dgvPersons.Rows[count].Cells[4].Value = p.IsProducer; this.dgvPersons.Rows[count].Cells[4].Value = p.IsMusician; this.dgvPersons.Rows[count].Cells[4].Value = p.IsCameraman; this.dgvPersons.Rows[count].Cells[4].Value = p.IsCutter; this.dgvPersons.Rows[count].Cells[4].Value = p.IsWriter; this.dgvPersons.Rows[count].Cells[5].Value = p.MovieQuantity; this.dgvPersons.Rows[count].Cells[6].Value = p.MovieQuantityAsActor; this.dgvPersons.Rows[count].Cells[7].Value = p.MovieQuantityAsDirector; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsProducer; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsMusician; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsCameraman; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsCutter; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsWriter; count++; } this.dgvPersons.Sort(this.dgvPersons.Columns[1], ListSortDirection.Ascending); } this._current_amount = list.Count; this.lblFound.Text = this._current_amount.ToString(); this.Cursor = Cursors.Default; } }
/// <summary> /// Load data /// </summary> /// <param name="filter">The filter.</param> /// <param name="value">The value.</param> private void _LoadData(FilterType filter, string value) { if(this.dgvMovies.InvokeRequired) { LoadDataCallback ldCall = new LoadDataCallback(_LoadData); this.Invoke(ldCall, new object[] { filter, value }); } else { this.Cursor = Cursors.WaitCursor; Stopwatch watch = new Stopwatch(); watch.Start(); if(__useDataBind) { this.dgvMovies.DataSource = null; } else { this.dgvMovies.Rows.Clear(); } this._movies = new List<Movie>(); /* * GETMOVIELIST */ Stopwatch watch2 = new Stopwatch(); watch2.Start(); switch(filter) { case FilterType.NoFilter: case FilterType.ResetFilter: this._movies = this._db.GetMovieList( this._sortExpression, ( this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending ) ); break; case FilterType.AllConferred: case FilterType.AllOriginals: case FilterType.WithoutGenre: this._movies = this._db.GetMovieList( filter, this._sortExpression, ( this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending ) ); break; case FilterType.Codec: this._movies = this._db.GetMovieList( filter, "", CodecHelper.GetCodecNumber(value), false, this._sortExpression, ( this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending ) ); break; case FilterType.Genre: case FilterType.Category: case FilterType.Name: case FilterType.Actor: case FilterType.Director: case FilterType.Producer: default: this._movies = this._db.GetMovieList( filter, value, this._sortExpression, ( this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending ) ); break; } watch2.Stop(); TimeSpan span2 = watch2.Elapsed; Console.WriteLine( "_LoadData [only GetMovieList] - Required time: {0} - {1}ms ({2} Ticks)", span2.ToString(), watch2.ElapsedMilliseconds, watch2.ElapsedTicks ); /* * DATABIND */ Stopwatch watch3 = new Stopwatch(); watch3.Start(); this._current_amount = this._movies.Count; this.tslblAmount.Text = "Anzahl Filme: " + this._current_amount.ToString(); //this._movies.Sort(); if(__useDataBind) { this.dgvMovies.AutoGenerateColumns = false; this.dgvMovies.DataSource = this._movies; } else { int count = 0; foreach(Movie mov in this._movies) { this.dgvMovies.Rows.Add(1); //tmp = mov.Quality.ToString(); //qualiText = tmp.Substring(0, mov.Quality.ToString().IndexOf("_")); //int.TryParse(tmp.Substring(tmp.LastIndexOf("_") + 1), out quali); //Static stc = this._sb.GetStaticItem("C002", mov.Country); this.dgvMovies.Rows[count].Cells[0].Value = mov.Id; this.dgvMovies.Rows[count].Cells[1].Value = mov.SortValue; this.dgvMovies.Rows[count].Cells[2].Value = mov.Number; this.dgvMovies.Rows[count].Cells[3].Value = mov.Name; this.dgvMovies.Rows[count].Cells[4].Value = mov.DiscAmount.ToString(); this.dgvMovies.Rows[count].Cells[5].Value = mov.IsOriginal; this.dgvMovies.Rows[count].Cells[6].Value = mov.Codec.ToString(); this.dgvMovies.Rows[count].Cells[7].Value = mov.GenerateGenresString; this.dgvMovies.Rows[count].Cells[8].Value = mov.GenerateCategoriesString; this.dgvMovies.Rows[count].Cells[9].Value = mov.GenerateQualityString; this.dgvMovies.Rows[count].Cells[10].Value = mov.CountryString; this.dgvMovies.Rows[count].Cells[11].Value = mov.IsConferred; this.dgvMovies.Rows[count].Cells[12].Value = mov.ConferredTo; count++; } this.dgvMovies.FirstDisplayedScrollingRowIndex = this._current_amount - 1; this.dgvMovies.Rows[this._current_amount - 1].Selected = true; } watch.Stop(); TimeSpan span = watch.Elapsed; watch3.Stop(); TimeSpan span3 = watch3.Elapsed; Console.WriteLine( "_LoadData [only DataBind] - Required time: {0} - {1}ms ({2} Ticks)", span3.ToString(), watch3.ElapsedMilliseconds, watch3.ElapsedTicks ); this.tslblAmount.Text += string.Format( " - Required time: {0} - {1}ms ({2} Ticks)", span.ToString(), watch.ElapsedMilliseconds, watch.ElapsedTicks ); this.Cursor = Cursors.Default; } }
/// <summary> /// Load the data /// </summary> /// <param name="mot">The mot.</param> /// <param name="name">The name.</param> private void _LoadData(MovieObjectType mot, string name) { if(this.dgvPersons.InvokeRequired) { LoadDataCallback ldCall = new LoadDataCallback(_LoadData); this.Invoke(ldCall, new object[] { mot, name }); } else { this.Cursor = Cursors.WaitCursor; if(__useDataBind) { this.dgvPersons.DataSource = null; } else { this.dgvPersons.Rows.Clear(); } name = name.Replace("'", "´"); List<Person> list = this._db.GetPersonList( mot, name, this._sortExpression, ( this._sortDirection == ListSortDirection.Ascending ? DataSortDirection.Ascending : DataSortDirection.Descending ) ); //PersonCollection list = this._db.GetPersonList(mot, name); //list.Sort((IComparer<Person>)new Person.SortByFirstname()); this._currentAmount = list.Count; int count = 0; if(__useDataBind) { this.dgvPersons.AutoGenerateColumns = false; this.dgvPersons.DataSource = list; } else { foreach(Person p in list) { this.dgvPersons.Rows.Add(1); this.dgvPersons.Rows[count].Cells[0].Value = p.ID; this.dgvPersons.Rows[count].Cells[1].Value = p.Firstname + " " + p.Lastname; this.dgvPersons.Rows[count].Cells[2].Value = p.IsActor; this.dgvPersons.Rows[count].Cells[3].Value = p.IsDirector; this.dgvPersons.Rows[count].Cells[4].Value = p.IsProducer; this.dgvPersons.Rows[count].Cells[4].Value = p.IsMusician; this.dgvPersons.Rows[count].Cells[4].Value = p.IsCameraman; this.dgvPersons.Rows[count].Cells[4].Value = p.IsCutter; this.dgvPersons.Rows[count].Cells[4].Value = p.IsWriter; this.dgvPersons.Rows[count].Cells[5].Value = p.MovieQuantity; this.dgvPersons.Rows[count].Cells[6].Value = p.MovieQuantityAsActor; this.dgvPersons.Rows[count].Cells[7].Value = p.MovieQuantityAsDirector; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsProducer; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsMusician; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsCameraman; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsCutter; this.dgvPersons.Rows[count].Cells[8].Value = p.MovieQuantityAsWriter; count++; } this.dgvPersons.Sort(this.dgvPersons.Columns[1], ListSortDirection.Ascending); } this._current_amount = list.Count; this.lblFound.Text = this._current_amount.ToString(); this.Cursor = Cursors.Default; } }