public void addToShortlist(ref DataGrid playerDataGrid) { List <int> playerRows = new List <int>(); for (int i = 0; i < playerDataGrid.SelectedItems.Count; ++i) { PlayerGridViewModel row = (PlayerGridViewModel)playerDataGrid.SelectedItems[i]; if (!context.shortlistIDList.Contains(row.ID)) { playerRows.Add(row.ID); } } if (playerRows.Count > 0) { globalFuncs.scoutTimer.start(); this.windowMain.CurrentGameDate.Text = context.fm.MetaData.IngameDate.ToLongDateString(); this.windowMain.vm.tabshortlist.TextBlockText = globalFuncs.localization.WindowMainLabels[3]; setControlAvailability(false); this.vm.results.Text = "Importing..."; LoadDelegate d = new LoadDelegate(this.loadShortlistPlayers); d.BeginInvoke(ref playerRows, null, null); ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar); p.BeginInvoke(null, null); } }
public void OpenSavedGame(string filename, bool isLoad = false, LoadDelegate loadFailCB = null) { _loadFailCallback = loadFailCB; if (!bLogin) { LoginGPGS(); } if (bLogin) { ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame; if (isLoad) { savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpenedForLoad); } else // is Save { savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpenedForSave); } } else if (isLoad && loadFailCB != null) { LoadRoutineEndCallBack(success: false); } }
public List <FrameworkElement> LoadItems(ItemType it) { LoadDelegate loadDelegate = null; switch (it) { case ItemType.BinaryImage: loadDelegate = LoadImage; break; case ItemType.DrawingImage: loadDelegate = LoadDrawingImage; break; } var items = new List <FrameworkElement>(); if (loadDelegate != null) { foreach (var name in ResourcesTable.UriTable) { if (name.StartsWith(Path, StringComparison.OrdinalIgnoreCase)) { try { Uri resUri = ResourcesTable.GetUri(name); Stream stream = Application.GetResourceStream(resUri).Stream; items.Add(loadDelegate(stream)); } catch { } } } } return(items); }
public static async Task PartialLoading(LoadDelegate load, AddAudioItem addItem, Int32 loadCount, CancellationToken token) { Int32 currentCount = 20; Int32 currentOffset = 0; do { if (currentCount + currentOffset > loadCount) currentCount = loadCount - currentOffset + 1; VKList<VKAudio> list = await load(currentOffset, currentCount, token); if (list != null && list.Items != null) { foreach (var item in list.Items) { token.ThrowIfCancellationRequested(); await addItem(item); } } else { break; } currentOffset += currentCount; currentCount *= 2; } while (currentOffset < loadCount); }
public void AsyncLoad(string bundlePath, string assetName, LoadDelegate lad) { StartCoroutine(AsyncLoadBundle(bundlePath, delegate(BundleHolder bh) { if (bh == null) { lad?.Invoke(null); return; } StartCoroutine(AsyncLoadAsset(bh.bundle, assetName, delegate(Object obj) { if (obj == null) { lad?.Invoke(null); bh.TryRelease(); return; } AssetRef ar = new AssetRef(); ar.asset = obj; ar.bh = bh; ar.Retain(); lad?.Invoke(ar); bh.TryRelease(); })); })); }
public void LoadLocalData() { if (this.InvokeRequired) { LoadDelegate ld = new LoadDelegate(LoadLocalData); this.Invoke(ld); } else { CustomerServer.GetCustomerAndRegion(ref _ht_Sender, ref _ht_Receiv, ref _ht_Region); FrmParent.ParentForm._AllRegion = RegionServer.GetAllRegion(); _storage_Scan = StorageServer.GetAllStorageScan(); _UCSenderInfo = new UCCustomerInfo(true); _UCRecevInfo = new UCCustomerInfo(false); _UCSenderInfo.Parent = this; _UCRecevInfo.Parent = this; _UCSenderInfo.Dock = DockStyle.None; _UCRecevInfo.Dock = DockStyle.None; _UCSenderInfo.Visible = false; _UCRecevInfo.Visible = false; _UCSenderInfo.Load(); _UCRecevInfo.Load(); } }
public static async Task PartialLoading(LoadDelegate load, AddAudioItem addItem, Int32 loadCount, CancellationToken token) { Int32 currentCount = 20; Int32 currentOffset = 0; do { if (currentCount + currentOffset > loadCount) { currentCount = loadCount - currentOffset + 1; } VKList <VKAudio> list = await load(currentOffset, currentCount, token); if (list != null && list.Items != null) { foreach (var item in list.Items) { token.ThrowIfCancellationRequested(); await addItem(item); } } else { break; } currentOffset += currentCount; currentCount *= 2; } while (currentOffset < loadCount); }
public XSLTProcessor(Context ctx) { _ctx = ctx; if (mvpXmlAvailable) { object transform = Activator.CreateInstance(mvpXmlType); Load = (LoadDelegate)Delegate.CreateDelegate(typeof(LoadDelegate), transform, loadMethodMvp); GetOutputSettings = (GetOutputSettingsDelegate)Delegate.CreateDelegate(typeof(GetOutputSettingsDelegate), transform, getOutputSettingsMethodMvp); TransformToWriter = (TransformToWriterDelegate)Delegate.CreateDelegate(typeof(TransformToWriterDelegate), transform, transformToWriterMethodMvp); } else { // Mvp.Xml not available -> falling back to XslCompiledTransform XslCompiledTransform transform = new XslCompiledTransform(); Load = new LoadDelegate(transform.Load); GetOutputSettings = (GetOutputSettingsDelegate) Delegate.CreateDelegate(typeof(GetOutputSettingsDelegate), transform, getOutputSettingsMethodFW); TransformToWriter = new TransformToWriterDelegate(transform.Transform); } this.xsltArgumentList = new XsltArgumentList(); }
private static LoadResult ParseTest(string name, LoadDelegate load) { var sw = new Stopwatch(); Log("With " + name); int x = 0, y = 0; var comp = ColorComponents.Grey; var parsed = new byte[0]; BeginWatch(sw); for (var i = 0; i < LoadTries; ++i) { parsed = load(out x, out y, out comp); } Log("x: {0}, y: {1}, comp: {2}, size: {3}", x, y, comp, parsed.Length); var passed = EndWatch(sw) / LoadTries; Log("Span: {0} ms", passed); return(new LoadResult { Width = x, Height = y, Components = comp, Data = parsed, TimeInMs = passed }); }
// Use this for initialization void Start() { if (loadHandler != null) { loadHandler(); loadHandler = null; } }
static AssetDatabaseLoader() { #if UNITY_EDITOR IsAvailable = true; GetAssetPaths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName; Load = ToLoadDelegate(GetAssetPaths); #endif }
public AssetPool(string format) { pool.SetRefType(AssetRefType.Weak); assetLoader = LoadAsset; if (format != null) { urlFormat = format; } }
public MainWindow() { InitializeComponent(); LoadDelegate oD = Load; Dispatcher.BeginInvoke ( oD, System.Windows.Threading.DispatcherPriority.Loaded, null ); }
public void LoadComplete(IAsyncResult ar) { // extract the delegate from the AsyncResult, and obtain result LoadDelegate ld = (LoadDelegate)((AsyncResult)ar).AsyncDelegate; ld.EndInvoke(ar); // set progress SetProgress(100); }
public void OpdLoad(string filename, MarketSet data) { // set progress SetProgress(0); // delegate async csv load LoadDelegate ld = new LoadDelegate(Core.Opd.Load); ld.BeginInvoke(filename, null, data, new AsyncCallback(this.LoadComplete), null); }
public FuncFactory( string name, InitDelegate initer, LoadDelegate loader ) { this.name = name; this.initer = initer; this.loader = loader; }
static CallbackHandler() { loadCallback = new LoadDelegate(load); unloadCallback = new UnloadDelegate(unload); openCallback = new OpenDelegate(open); listCallback = new ListDelegate(list); listFileInfoCallback = new ListFileInfoDelegate(listFileInfo); findCallback = new FindDelegate(find); findFileInfoCallback = new FindFileInfoDelegate(findFileInfo); existsCallback = new ExistsDelegate(exists); }
public CLoadObject( int eResourceType, string resourceName, LoadDelegate callback = null, CLoadPriority priority = CLoadPriority.NORMAL, System.Object args = null, CReleaseType releaseType = CReleaseType.Normal, bool isAsynMode = true ) { _Load(eResourceType, resourceName, callback, priority, args, releaseType, isAsynMode); }
public frmLoading(LoadDelegate load) { InitializeComponent(); this.load = load; try { Trace.Listeners.Add(new traceToStatus(SubStatus)); } catch { } thread = new Thread(() => { finish(load(Status)); }); }
void UpdateLoadMethod() { if (IsSimulationEnabled) { switch (m_Simulation) { case AssetSimulation.AssetDatabase: Load = AssetDatabaseLoader.Load; return; case AssetSimulation.AssetGraph: Load = AssetGraphLoader.Load; return; } } Load = LoadCore; }
/// <summary> /// Loads this ModelNode asynchronously. /// </summary> internal void BeginLoad() { lock (m_oAsyncLock) { if (m_eStatus != LoadState.Unloaded) { return; } LoadDelegate oLoad = new LoadDelegate(Load); AsyncContext oContext = new AsyncContext(m_iLoadSync, oLoad); m_oCurrentAsyncResult = oLoad.BeginInvoke(_EndLoad, oContext); m_eStatus = LoadState.Loading; } }
/// <summary> /// Loads the native SORTERAPI methods. /// </summary> private void LoadMethods() { m_dlgApplyLoadOrder = (ApplyLoadOrderDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_apply_load_order"), typeof(ApplyLoadOrderDelegate)); m_dlgCleanup = (CleanupDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_cleanup"), typeof(CleanupDelegate)); m_dlgCreateDb = (CreateSorterDbDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_create_db"), typeof(CreateSorterDbDelegate)); m_dlgDestroyDb = (DestroySorterDbDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_destroy_db"), typeof(DestroySorterDbDelegate)); m_dlgEvalLists = (EvalConditionalsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_eval_lists"), typeof(EvalConditionalsDelegate)); m_dlgGetBuildId = (GetBuildIdDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_get_build_id"), typeof(GetBuildIdDelegate)); m_dlgGetDirtyInfo = (GetDirtyInfoDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_get_dirty_info"), typeof(GetDirtyInfoDelegate)); m_dlgGetErrorMessage = (GetLastErrorDetailsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_get_error_message"), typeof(GetLastErrorDetailsDelegate)); m_dlgGetMasterlistRevision = (GetMasterlistRevisionDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_get_masterlist_revision"), typeof(GetMasterlistRevisionDelegate)); m_dlgLoadLists = (LoadDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_load_lists"), typeof(LoadDelegate)); m_dlgSortPlugins = (SortPluginsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_sort_plugins"), typeof(SortPluginsDelegate)); m_dlgUpdateMasterlist = (UpdateMasterlistDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrSorterApi, "loot_update_masterlist"), typeof(UpdateMasterlistDelegate)); }
public void startloadAsset(string name) { if (!AseetFamily.ContainsKey(name) || AseetFamily[name] == null) { StartCoroutine(load_sub(name)); } else { if (LoadCallBack != null) { LoadCallBack(); LoadCallBack = null; } } }
IEnumerator load_sub(string name) { string[] sArray = name.Split('/'); string assetname = sArray[1]; string suffix = ""; string filename = ""; switch (sArray[0]) { case "View": { suffix = ".aseetbundle"; filename = "prefab"; } break; case "Scenes": { suffix = ".unity3d"; filename = "Scenes"; } break; } string path = "file://" + Application.dataPath + "/" + "StreamingAssets" + "/" + filename + "/" + assetname + suffix; //WWW www = new WWW(path); WWW www = WWW.LoadFromCacheOrDownload(path, Version); yield return(www); if (www.error == null) { AssetBundle ab = www.assetBundle; if (!AseetFamily.ContainsKey(name)) { AseetFamily.Add(name, ab); } if (LoadCallBack != null) { LoadCallBack(); LoadCallBack = null; } //ab.Unload(false); } else { Debug.LogError(www.error); } }
public void addToShortlist(int ID) { List <int> playersToLoad = new List <int>(); playersToLoad.Add(ID); globalFuncs.scoutTimer.start(); this.windowMain.CurrentGameDate.Text = context.fm.MetaData.IngameDate.ToLongDateString(); this.windowMain.vm.tabshortlist.TextBlockText = globalFuncs.localization.WindowMainLabels[3]; setControlAvailability(false); this.vm.results.Text = "Importing..."; LoadDelegate d = new LoadDelegate(this.loadShortlistPlayers); d.BeginInvoke(ref playersToLoad, null, null); ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar); p.BeginInvoke(null, null); }
public string GetProp(string name, string name2check, LoadDelegate load) { if (props.ContainsKey("@" + name2check)) { return(props["@" + name]); } if (!props.ContainsKey(name2check)) { if (!New) { load(); //пытаемся загрузить } if (!props.ContainsKey(name2check)) { return(props["@" + name] = ""); //автоинициализация (если не загрузили) } } return(props[name]); }
public MainWindow() { InitializeComponent(); //об'єкт делегату, в який присвоється метод завантаження LoadDelegate load = new LoadDelegate(LoadMethod); //Запуск делегату в новому потоці this.Dispatcher.BeginInvoke(load); //Показовий клас та метод категорії CategoryTMP c = new CategoryTMP(); AddCategoryToCategoryList(c); //Показовий метод відображення профілю Image im = new Image(); im.Source = new BitmapImage(new Uri(exepath + @"\Images\tmp.png")); RefreshProfile("Антон Гвидон", "1956", im); }
async public Task Add(IOldNew input, LoadDelegate action) { if (cancel) { Loading = false; return; } if (input.Old == input.New) { return; } if (Loading) { queue.Enqueue(input); return; } Loading = true; await action(input); if (cancel) { Loading = false; return; } IOldNew next = null; if (queue.Any()) { next = queue.Dequeue(); } Loading = false; if (next != null) { await Add(next, action); } }
private void registerLoadDelegate <T>(LoadDelegate dlg) { Type type = typeof(T); lock (this) { if (!m_loadDelegates.ContainsKey(type)) { m_loadDelegates.Add(typeof(T), dlg); } else { LoadDelegate existing; m_loadDelegates.TryGetValue(type, out existing); if (dlg != existing) { throw new Exception("SSAssetManager: Conflicting registration of a load delegate"); } } } }
/// <summary> /// Loads the native BAPI methods. /// </summary> private void LoadMethods() { m_dlgGetLastErrorDetails = (GetLastErrorDetailsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "GetLastErrorDetails"), typeof(GetLastErrorDetailsDelegate)); m_dlgCreateBossDb = (CreateBossDbDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "CreateBossDb"), typeof(CreateBossDbDelegate)); m_dlgDestroyBossDb = (DestroyBossDbDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "DestroyBossDb"), typeof(DestroyBossDbDelegate)); m_dlgLoad = (LoadDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "Load"), typeof(LoadDelegate)); m_dlgEvalConditionals = (EvalConditionalsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "EvalConditionals"), typeof(EvalConditionalsDelegate)); m_dlgUpdateMasterlist = (UpdateMasterlistDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "UpdateMasterlist"), typeof(UpdateMasterlistDelegate)); m_dlgSortMods = (SortModsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "SortMods"), typeof(SortModsDelegate)); m_dlgGetLoadOrder = (GetLoadOrderDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "GetLoadOrder"), typeof(GetLoadOrderDelegate)); m_dlgSetLoadOrder = (SetLoadOrderDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "SetLoadOrder"), typeof(SetLoadOrderDelegate)); m_dlgGetActivePlugins = (GetActivePluginsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "GetActivePlugins"), typeof(GetActivePluginsDelegate)); m_dlgSetActivePlugins = (SetActivePluginsDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "SetActivePlugins"), typeof(SetActivePluginsDelegate)); m_dlgGetPluginLoadOrder = (GetPluginLoadOrderDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "GetPluginLoadOrder"), typeof(GetPluginLoadOrderDelegate)); m_dlgSetPluginLoadOrder = (SetPluginLoadOrderDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "SetPluginLoadOrder"), typeof(SetPluginLoadOrderDelegate)); m_dlgGetIndexedPlugin = (GetIndexedPluginDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "GetIndexedPlugin"), typeof(GetIndexedPluginDelegate)); m_dlgSetPluginActive = (SetPluginActiveDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "SetPluginActive"), typeof(SetPluginActiveDelegate)); m_dlgIsPluginActive = (IsPluginActiveDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "IsPluginActive"), typeof(IsPluginActiveDelegate)); m_dlgIsMaster = (IsMasterDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(m_ptrBossApi, "IsPluginMaster"), typeof(IsMasterDelegate)); }
protected override void OnLoad() { _load = GetMethod <LoadDelegate>("hcp_Load", true); _unload = GetMethod <UnloadDelegate>("hcp_Unload", false); _toValue = GetMethod <ToValueDelegate>("hcp_tovalue", false); _getArgumentHandle = GetMethod <GetArgumentHandleDelegate>("hcp_argat", false); _getMessage = GetMethod <GetMessageDelegate>("hcp_GetMessage", false); _encode = GetMethod <EncodeDelegate>("hcp_Encode", false); _decode = GetMethod <DecodeDelegate>("hcp_Decode", false); _newCodec = GetMethod <NewCodecDelegate>("hcp_NewCodec", false); _closeCodec = GetMethod <CloseCodecDelegate>("hcp_CloseCodec", false); _loadCodec = GetMethod <LoadCodecDelegate>("hcp_LoadCodec", false); _loadModel = GetMethod <LoadModelDelegate>("hcp_LoadModel", false); try { _state = _load(); } catch (Exception x) { throw new Exception("Error occured while calling 'hcp_Load': " + x.Message); } }
public XSLTProcessor() : base(ScriptContext.CurrentContext, true) { if (mvpXmlAvailable) { object transform = Activator.CreateInstance(mvpXmlType); Load = (LoadDelegate)Delegate.CreateDelegate(typeof(LoadDelegate), transform, loadMethodMvp); GetOutputSettings = (GetOutputSettingsDelegate)Delegate.CreateDelegate(typeof(GetOutputSettingsDelegate), transform, getOutputSettingsMethodMvp); TransformToWriter = (TransformToWriterDelegate)Delegate.CreateDelegate(typeof(TransformToWriterDelegate), transform, transformToWriterMethodMvp); TransformToStream = (TransformToStreamDelegate)Delegate.CreateDelegate(typeof(TransformToStreamDelegate), transform, transformToStreamMethodMvp); } else { // Mvp.Xml not available -> falling back to XslCompiledTransform XslCompiledTransform transform = new XslCompiledTransform(); Load = new LoadDelegate(transform.Load); GetOutputSettings = (GetOutputSettingsDelegate) Delegate.CreateDelegate(typeof(GetOutputSettingsDelegate), transform, getOutputSettingsMethodFW); TransformToWriter = new TransformToWriterDelegate(transform.Transform); TransformToStream = new TransformToStreamDelegate(transform.Transform); } this.xsltArgumentList = new XsltArgumentList(); }
public Delegate(LoadDelegate ld) { this.ld = ld; }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); RegisterResource(); BuildToolBar(); Edit += new EditDelegate(DoEdit); Minimize += new MinimizeDelegate(DoMinimize); Maximize += new MaximizeDelegate(DoMaximize); Load += new LoadDelegate(DoLoad); Create += new CreateDelegate(DoCreate); Close += new CloseDelegate(DoClose); }
protected void Page_Load(object sender, EventArgs e) { RegisterResource(); BuildToolBar(); if(Edit != null) Edit += new EditDelegate(DoEdit); if(Minimize != null) Minimize += new MinimizeDelegate(DoMinimize); if(Maximize != null) Maximize += new MaximizeDelegate(DoMaximize); if(Load != null) Load += new LoadDelegate(DoLoad); if(Create != null) Create += new CreateDelegate(DoCreate); if(Close != null) Close += new CloseDelegate(DoClose); }