public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { LoaderGroup loaderGroup = new LoaderGroup(); PopulatedLoadGroup(loaderGroup); loaderGroup.LoadAsync(onLoadSuccess, onLoadFailed); }
public UCCefSharpX64(string url) { InitializeComponent(); var setting = new CefSettings(); // 设置语言 setting.Locale = "zh-CN"; //cef设置userAgent setting.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"; //配置浏览器路径 setting.BrowserSubprocessPath = $"{CefSharpHelp.PathX64}\\CefSharp.BrowserSubprocess.exe"; Cef.Initialize(setting, true, true); // Add it to the form and fill it to the form window. chromeBrowser = new ChromiumWebBrowser(url); this.Controls.Add(chromeBrowser); chromeBrowser.Dock = DockStyle.Fill; chromeBrowser.AddressChanged += (sender, e) => { AddressChanged?.Invoke(sender, e.Address); }; chromeBrowser.StatusMessage += (sender, e) => { StatusMessage?.Invoke(sender, e.Value); }; chromeBrowser.ConsoleMessage += (sender, e) => { ConsoleMessage?.Invoke(sender, new ICefSharp.Model.ConsoleMessageEventArgs(e.Message, e.Source, e.Line)); }; chromeBrowser.LoadingStateChanged += (sender, e) => { LoadingStateChanged?.Invoke(sender, new ICefSharp.Model.LoadingStateChangedEventArgs(e.CanGoForward, e.CanGoBack, e.CanReload, e.IsLoading)); }; chromeBrowser.LoadError += (sender, e) => { LoadError?.Invoke(sender, new ICefSharp.Model.LoadErrorEventArgs((int)e.ErrorCode, e.FailedUrl, e.ErrorText)); }; chromeBrowser.IsBrowserInitializedChanged += (sender, e) => { IsBrowserInitializedChanged?.Invoke(sender, e.IsBrowserInitialized); }; chromeBrowser.TitleChanged += (sender, e) => { TitleChanged?.Invoke(sender, e.Title); }; }
private void InitializeSmartEvent() { // focus dummy _focusIn = new SmartEvent(this, "focused"); _focusOut = new SmartEvent(this, "unfocused"); _focusIn.On += (s, e) => { ((WebView)s).SetFocus(true); }; _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); }; _loadStarted = new SmartEvent(this, _realHandle, "load,started"); _loadFinished = new SmartEvent(this, _realHandle, "load,finished"); _loadError = new SmartEvent <SmartCallbackLoadErrorArgs>(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent); _titleChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent); _urlChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent); _contextMenuCustomize = new SmartEvent <ContextMenuCustomizeEventArgs>(this, _realHandle, "contextmenu,customize", ContextMenuCustomizeEventArgs.CreateFromSmartEvent); _contextMenuItemSelected = new SmartEvent <ContextMenuItemEventArgs>(this, _realHandle, "contextmenu,selected", ContextMenuItemEventArgs.CreateFromSmartEvent); _policyNavigationDecide = new SmartEvent <NavigationPolicyEventArgs>(this, _realHandle, "policy,navigation,decide", NavigationPolicyEventArgs.CreateFromSmartEvent); _policyNewWindowDecide = new SmartEvent <NewWindowPolicyEventArgs>(this, _realHandle, "policy,newwindow,decide", NewWindowPolicyEventArgs.CreateFromSmartEvent); _policyResponseDecide = new SmartEvent <ResponsePolicyEventArgs>(this, _realHandle, "policy,response,decide", ResponsePolicyEventArgs.CreateFromSmartEvent); _loadStarted.On += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); }; _loadFinished.On += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); }; _loadError.On += (s, e) => { LoadError?.Invoke(this, e); }; _titleChanged.On += (s, e) => { TitleChanged?.Invoke(this, e); }; _urlChanged.On += (s, e) => { UrlChanged?.Invoke(this, e); }; _policyNavigationDecide.On += (s, e) => { NavigationPolicyDecideRequested?.Invoke(this, e); }; _policyNewWindowDecide.On += (s, e) => { NewWindowPolicyDecideRequested?.Invoke(this, e); }; _policyResponseDecide.On += (s, e) => { ResponsePolicyDecideRequested?.Invoke(this, e); }; _contextMenuItemSelected.On += (s, e) => { ContextMenuItemSelected?.Invoke(this, e); }; _contextMenuCustomize.On += (s, e) => { _contextMenuCustomizeDelegate?.Invoke(e.Menu); }; }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadError) { try { // Load asset from assetBundle. string fileName = System.IO.Path.GetFileNameWithoutExtension(_path); AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(_bundle, fileName, typeof(UnityEngine.Object)); if (request == null) { return; } TaskProvider.Instance.RunTask(request, () => { _asset = request.GetAsset <UnityEngine.Object>(); IsLoaded = true; if (_asset is ILoadableObject) { (_asset as ILoadableObject).LoadAsync(onLoadSuccess, onLoadError); } else { onLoadSuccess(); } }); } catch (Exception e) { onLoadError(new LoadException(e.ToString(), e)); } }
public UCChorme() { InitializeComponent(); if (this.IsDesignMode()) { return; } //动态创建,以免可视化时组件异常 Chrome = new ChromiumWebBrowser(); Chrome.MenuHandler = new Handlers.ChromeMenuHandler(); Chrome.RegisterJsObject("lw", new ChormeScripts(this), new CefSharp.BindingOptions() { CamelCaseJavascriptNames = false }); Chrome.FrameLoadStart += (s, e) => { LoadStart?.Invoke(s, e); }; Chrome.FrameLoadEnd += (s, e) => { LoadEnd?.Invoke(s, e); }; Chrome.LoadError += (s, e) => { LoadError?.Invoke(s, e); }; this.root.Children.Add(Chrome); }
public override sealed void Load(OpenedFile file, Stream stream) { try { LoadInternal(file, new UnclosableStream(stream)); if (errorList.Count > 0) { errorList.Remove(file); if (errorList.Count == 0) { panel.Controls.Clear(); if (userControl != null) { panel.Controls.Add(userControl); } } else { ShowError(errorList.Values.First().exception); } } } catch (Exception ex) { errorList[file] = new LoadError(ex, stream); ShowError(ex); } }
public virtual void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadError) { int objectsToLoad = _loadables.Count; int objectsLoaded = 0; bool hasError = false; LoadSuccess onComplete = () => { if (++objectsLoaded >= objectsToLoad) { onLoadSuccess(); } }; LoadError onError = (e) => { if (!hasError) { onLoadError(e); } hasError = true; }; if (_loadables.Count == 0) { TaskProvider.Instance.DelayedAction(() => onComplete()); } else { foreach (ILoadableObject loadable in _loadables) { loadable.LoadAsync(onComplete, onError); } } }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadError) { _action.Invoke(() => { IsLoaded = true; onLoadSuccess(); }, onLoadError); }
protected override void InternalLoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { LoadSourceDataAsync((source) => { PopulateData(source, ref _dataLookup); onLoadSuccess(); }, onLoadFailed); }
private void OpenEntityWithLoadError(LoadError loadError) { if (loadError.IsAEntity) { _parent.DiplayAEntity(_reportProxy.Value.ProfileId, loadError.EntityId); } else { _parent.DiplayBEntity(_reportProxy.Value.ProfileId, loadError.EntityId); } }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { LoaderGroup loaderGroup = new LoaderGroup(); loaderGroup.AppendProvider(_loaderGroup); PopulatedLoadGroup(loaderGroup); loaderGroup.LoadAsync(() => { IsLoaded = true; onLoadSuccess(); }, onLoadFailed); }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadError) { List <LoaderGroup> .Enumerator groups = _groups.GetEnumerator(); if (groups.MoveNext()) { groups.Current.LoadAsync(() => { GroupLoaded(groups, onLoadSuccess, onLoadError); }, onLoadError); } else { TaskProvider.Instance.DelayedAction(() => onLoadSuccess()); } }
protected override void InternalLoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { try { _pandeaGameConfigurationData = Resources.Load <PandeaGameConfigurationData>(PandeaGameConfigurationDataPath); _pandeaGameConfigurationData.LoadAsync(onLoadSuccess, onLoadFailed); } catch (Exception e) { onLoadFailed(new LoadException("Failed to load game data.", e)); throw; } }
private void DoLoad(LoadSuccess onLoadSuccess, LoadError onLoadError, int i) { _loadables[i].LoadAsync(() => { i++; if (i < _loadables.Count) { DoLoad(onLoadSuccess, onLoadError, i); } else { onLoadSuccess(); } }, onLoadError); }
/// For use in conjunction with LoadModelAsync(), returns true when the async load is complete, /// false while still loading. /// /// Throws if called after async load is complete or before async load started. /// When this returns, the Model will be either Valid, or LoadError will be set. public bool TryLoadModel() { GameObject go = null; bool isValid = false; LoadError? error = null; try { if (!m_builder.TryEndAsyncLoad(out go, out m_ImportMaterialCollector)) { return(false); } isValid = m_builder.IsValid; } catch (ObjectDisposedException ex) { // This is a bad exception, it means we closed the future before calling TryGetModel. error = new LoadError("Internal error", ex.Message); Debug.LogException(ex); } catch (FutureFailed ex) { // Something went wrong in the glTF loader on the background thread. error = new LoadError("Invalid data", ex.InnerException?.Message); Debug.LogException(ex); // TODO: Temporary, for b/139759540 and b/134430318 // Leave the other exception alone so our analytics get the aggregated results. Debug.LogException( new Exception(string.Format("Failed loading model {0}", m_Location), ex)); } m_builder = null; if (!isValid) { m_LoadError = error ?? new LoadError("Unexpected Failure"); } else { m_AllowExport = go != null; CreatePrefab(go); } // Even if an exception occurs above, return true because the return value indicates async load // is complete. return(true); }
/// <summary> /// Initializes a new instance of the <see cref="ProjectDefinition" /> class. /// </summary> /// <param name="path">The path.</param> /// <param name="outputDirectory">The output directory.</param> /// <param name="globalProperties">The global properties.</param> /// <param name="assemblyResolver">The assembly resolver.</param> /// <param name="projectCollection">The project collection.</param> public ProjectDefinition(string path, string outputDirectory = null, IDictionary <string, string> globalProperties = null, IAssemblyResolver assemblyResolver = null, ProjectCollection projectCollection = null) { ProjectPath = path; _assemblyResolver = assemblyResolver ?? new AssemblyResolver(); _projectCollection = projectCollection ?? new ProjectCollection(); _projectDirectory = Path.GetDirectoryName(path); _globalProperties = globalProperties; try { Project = new Project(path, globalProperties, null, projectCollection); } catch (Exception e) { LoadError?.Invoke(this, new ProjectDefinitionLoadErrorEventArgs(e, this)); } _outputDirectory = outputDirectory ?? Path.GetDirectoryName(TargetPath); }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { if (_list != null) { int loaded = 0; _list.ForEach((weakReference) => { weakReference.LoadAssetAsync <T>((data, reference) => { if (++loaded >= _list.Count) { IsLoaded = true; onLoadSuccess(); } }, (exception) => { onLoadFailed(new LoadException("Failed to load asset in list.", exception)); }); }); } }
static string ToReadableString(LoadError err) { switch (err) { case LoadError.Success: return "Success"; case LoadError.InvalidVersion: return "Invalid version"; case LoadError.InvalidChecksum: return "Invalid checksum"; case LoadError.InvalidBufferLength: return "Invalid buffer length"; case LoadError.InvalidBufferChecksum: return "Invalid buffer checksum"; } throw new ArgumentOutOfRangeException("err"); }
public void LoadAsync(LoadSuccess onComplete, LoadError onError) { WeakReference[] weakReferences = WeakReferences(); int assetCount = weakReferences.Length; int totalLoadsRequired = assetCount + 1; int loadsCompleted = 0; bool hasFailed = false; Action <WeakReference> assetLoaded = (reference) => { if (++loadsCompleted >= totalLoadsRequired) { onComplete(); } }; LoadSuccess adjunctLoaded = () => { if (++loadsCompleted >= totalLoadsRequired) { onComplete(); } }; Action <WeakReferenceException> assetLoadFailed = (e) => { if (!hasFailed) { onError(new LoadException("Failed to load references", e)); } hasFailed = true; }; foreach (WeakReference reference in weakReferences) { reference.LoadAssetAsync(assetLoaded, assetLoadFailed); } AdjunctLoad(adjunctLoaded, onError); }
public override sealed void Load(OpenedFile file, Stream stream) { try { LoadInternal(file, new UnclosableStream(stream)); if (errorList.Count > 0) { errorList.Remove(file); if (errorList.Count == 0) { SD.WinForms.SetContent(contentControl, userContent, this); } else { ShowError(errorList.Values.First().exception); } } } catch (Exception ex) { errorList[file] = new LoadError(ex, stream); ShowError(ex); } }
private void InitializeSmartEvent() { // focus dummy _focusIn = new SmartEvent(this, "focused"); _focusOut = new SmartEvent(this, "unfocused"); _focusIn.On += (s, e) => { ((WebView)s).SetFocus(true); }; _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); }; _loadStarted = new SmartEvent(this, _realHandle, "load,started"); _loadFinished = new SmartEvent(this, _realHandle, "load,finished"); _loadError = new SmartEvent <SmartCallbackLoadErrorArgs>(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent); _titleChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent); _urlChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent); _loadStarted.On += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); }; _loadFinished.On += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); }; _loadError.On += (s, e) => { LoadError?.Invoke(this, e); }; _titleChanged.On += (s, e) => { TitleChanged?.Invoke(this, e); }; _urlChanged.On += (s, e) => { UrlChanged?.Invoke(this, e); }; }
public override void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadError) { try { AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(_sceneName, LoadSceneMode.Additive); asyncLoad.completed += (operation) => { _scene = SceneManager.GetSceneByName(_sceneName); /*foreach (GameObject go in _scene.GetRootGameObjects()) * { * go.transform.SetParent(GetTransform()); * }*/ onLoadSuccess(); }; } catch (Exception e) { onLoadError(new LoadException("There was a problem loading scene data", e)); } }
public override void DidFailNavigation(WKWebView webView, WKNavigation navigation, NSError error) { LoadError?.Invoke(error.DebugDescription); }
public override sealed void Load(OpenedFile file, Stream stream) { try { LoadInternal(file, new UnclosableStream(stream)); if (errorList.Count > 0) { errorList.Remove(file); if (errorList.Count == 0) { contentControl.SetContent(userContent, this); } else { ShowError(errorList.Values.First().exception); } } } catch (Exception ex) { errorList[file] = new LoadError(ex, stream); ShowError(ex); } }
internal protected virtual void OnLoadError(LoadErrorEventArgs e) { LoadError?.Invoke(this, e); }
/// <summary> /// Handles the <see cref="E:LoadError" /> event. /// </summary> /// <param name="args">The <see cref="LoadErrorEventArgs"/> instance containing the event data.</param> void IWebBrowserInternal.OnLoadError(LoadErrorEventArgs args) { LoadError?.Invoke(this, args); }
/// <summary> /// The on load error. /// </summary> /// <param name="eventArgs"> /// The event args. /// </param> public void OnLoadError(LoadErrorEventArgs eventArgs) { LoadError?.Invoke(this, eventArgs); }
protected abstract void InternalLoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed);
protected virtual void AdjunctLoad(LoadSuccess onComplete, LoadError onError) { onComplete(); }
public void LoadAsync(LoadSuccess onLoadSuccess, LoadError onLoadFailed) { InternalLoadAsync(() => { IsLoaded = true; onLoadSuccess(); }, onLoadFailed); }
internal static string evas_load_error_str(LoadError error) { return(Marshal.PtrToStringAnsi(_evas_load_error_str(error))); }
internal static extern IntPtr _evas_load_error_str(LoadError error);
public override sealed void Load(OpenedFile file, Stream stream) { try { LoadInternal(file, new UnclosableStream(stream)); if (errorList.Count > 0) { errorList.Remove(file); if (errorList.Count == 0) { panel.Controls.Clear(); if (userControl != null) { panel.Controls.Add(userControl); } } else { ShowError(errorList.Values.First().exception); } } } catch (Exception ex) { errorList[file] = new LoadError(ex, stream); ShowError(ex); } }