private void cbPlayFinished(IntPtr pParam) { lock (this) { CallbackParams param = callbacks[pParam.ToInt32()]; if (param == null) { return; } param.Exec(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !IsCallback) { if (OnFirstLoad()) { return; } } if (GridControl.IsCallback || NavBarCallback.IsCallback) { NameValueCollection parameters = SqlParams.Get(CallbackParams.Get(Request), Session); if (parameters != null) { Session["Author"] = parameters["Author"]; Session["Book"] = parameters["Book"]; Session["Sort"] = parameters["Sort"]; Session["Mode"] = parameters["Mode"]; Session["Id"] = GetGuid(parameters["Id"]); if (NavBarCallback.IsCallback) { BuildNavBar(); } } } Author = (String)Session["Author"]; PrepareMenuItems(); BindDataGrid( (String)Session["Author"], (String)Session["Book"], (String)Session["Sort"], (String)Session["Mode"]); if (Session["Id"] is Guid) { int FocusedRowIndex = GridControl.FindVisibleIndexByKeyValue(Session["Id"]); if (FocusedRowIndex < 0) { FocusedRowIndex = 0; } GridControl.FocusedRowIndex = FocusedRowIndex; Session["Id"] = null; } }
private void buttonGo_Click(object sender, EventArgs e) { DirectoryInfo dirInfo = new DirectoryInfo(this.textBoxFolderOpen.Text); RecursiveTree recursiveTree = new RecursiveTree(); Action <String> updateMusicFile = s => TouchFile(s); CallbackParams callbackParams = new CallbackParams() { RootDirectory = dirInfo, DelegateMethod = updateMusicFile }; ThreadPool.QueueUserWorkItem(new WaitCallback(recursiveTree.WalkDirectoryTreeCallback), (Object)callbackParams); }
public bool CompileMML(string mmlString, ref int errorCode, ref UInt32 errorLine, bool isWave, delegatePlayFinished dlgPlayFinished, object parent) { if (hHandle == IntPtr.Zero) { return(true); } lock (this) { CallbackParams info = new CallbackParams(this, parent, dlgPlayFinished); int hash = this.GetHashCode(); callbacks[hash] = info; return(DllCompileMML(hHandle, mmlString, ref errorCode, ref errorLine, (byte)(isWave ? 1 : 0), cbInstancePlayFinished, hash)); } }
/// <summary> /// 模板读取事件 /// </summary> /// <param name="callbackParams"></param> public void OnAjaxTemplateRender(CallbackParams callbackParams) { //读取模板及内容 var content = GetAjaxTemplateContent(callbackParams); var data = GetAjaxTemplateData(callbackParams); //转换成json数据 var jsonString = SerializationManager.SerializeJson(data); var obj = JObject.Parse(jsonString); obj["jst"] = content; //返回模板信息 var templateContent = obj.ToString(Newtonsoft.Json.Formatting.Indented); this.TemplateContent = templateContent; }
/// <summary> /// 读取控件内容 /// </summary> /// <param name="controlPath"></param> /// <param name="callbackParams"></param> /// <returns></returns> protected string ReaderControl(string controlPath, CallbackParams callbackParams) { //控件路径 controlPath = controlPath.ToLower().EndsWith(".ascx") ? controlPath : controlPath + ".ascx"; //读取模板内容 Control control = Page.LoadControl(controlPath); if (control != null) { if (control is IAjaxInitHandler) (control as IAjaxInitHandler).OnAjaxInit(callbackParams); if (control is IAjaxProcessHandler) (control as IAjaxProcessHandler).OnAjaxProcess(callbackParams); //处理模板信息 StringBuilder sb = new StringBuilder(); control.RenderControl(new HtmlTextWriter(new StringWriter(sb))); return sb.ToString(); } return string.Empty; }
/// <summary> /// 获取模板数据 /// </summary> /// <param name="callbackParams"></param> /// <returns></returns> protected abstract object GetAjaxTemplateData(CallbackParams callbackParams);
/// <summary> /// 获取模板内容 /// </summary> /// <returns></returns> protected abstract string GetAjaxTemplateContent(CallbackParams callbackParams);