private void MainWebView_ScriptNotify(object sender, NotifyEventArgs e) { if (!string.IsNullOrEmpty(e.Value)) { var notify = JsonConvert.DeserializeObject <NotifyPackage>(e.Value); switch (notify.Key) { case WebScriptNotifyType.AppLoaded: IsControlLoaded = true; IsLoadingRingActive = false; break; case WebScriptNotifyType.EditorLoaded: IsEditorLoaded = true; break; case WebScriptNotifyType.ExcuteActionSuccess: case WebScriptNotifyType.DefineThemeSuccess: ExcuteSuccess?.Invoke(this, new EditorExcuteSuccessEventArgs(notify.Key, notify.Value)); break; case WebScriptNotifyType.ExcuteActionFailed: case WebScriptNotifyType.DefineThemeFailed: case WebScriptNotifyType.SetThemeFailed: ExcuteFailed?.Invoke(this, new EditorExcuteFailedEventArgs(notify.Value)); break; case WebScriptNotifyType.Save: RequestSave?.Invoke(this, EventArgs.Empty); break; case WebScriptNotifyType.ContentChanged: ContentChanged?.Invoke(this, EventArgs.Empty); break; case WebScriptNotifyType.ContextMenu: ShowContextMenuFlyout(notify.Value); break; case WebScriptNotifyType.Resize: Resize?.Invoke(this, new EditorResizeEventArgs(Convert.ToDouble(notify.Value))); break; default: break; } } }
void OnRequestSave() { ManipulationData(); RequestSave?.Invoke(this, EventArgs.Empty); }