private void OnPreparedExpand(IAsyncResult res) { try { try { m_node.EndLoadChildren(res); m_tree.Tree.BeginUpdate(); m_expanding = false; FillChildren(); Expand(); RefreshSelf(); m_node.NotifyExpanded(); } finally { m_tree.Tree.EndUpdate(); } } catch (Exception e) { Errors.Report(e); } ProcessRegister.RemoveBackgroundTask("s_expand"); }
public void Connect() { if (!EnabledConnect()) { return; } m_connecting = true; CallRefresh(); ProcessRegister.AddBackgroundTask("s_connect"); m_conn.BeginOpen(Async.CreateInvokeCallback(RealNode.Invoker, (AsyncCallback)Connected)); }
void LoadedData(IAsyncResult async) { try { async.StandaloneEndInvoke(); Controls.ShowError(false, null, ControlVisibility); } catch (Exception e) { HandleError(e); } Controls.ShowProgress(false, null, ControlVisibility); ProcessRegister.RemoveBackgroundTask("s_loading_data"); ShowDataInGui(); m_isLoading = false; }
private void DoRun() { m_reportEnv.OnStart(); using (var ub = new UsageBuilder("process")) { try { try { SetState(ProcessState.Running); ProcessRegister.OnStartedProcess(this); Logging.Debug("Starting process {0}", Title); this.LogMessage("s_process", LogLevel.Info, Texts.Get("s_process_started")); Run(); this.LogMessage("s_process", LogLevel.Info, Texts.Get("s_process_finished")); SetState(ProcessState.Finished); Logging.Debug("Process {0} finished succesfully", Title); } finally { m_curWork = "s_finished"; HProcess.CallFinishedProcess(this); m_finished = DateTime.Now; ub["result"] = "ok"; } } catch (Exception e) { m_failError = e; this.LogError(e); //this.LogMessage("s_process", LogLevel.Error, Errors.ExtractMessage(e)); this.LogMessage("s_process", LogLevel.Error, Texts.Get("s_process_failed")); Logging.Error("Error when running process {0}, process finished abnormally", Title); SetState(ProcessState.Error_Finished); ub["result"] = "error"; ub["error"] = e.Message; //Errors.Report(e); } } if (OnFinish != null) { OnFinish(); } m_reportEnv.OnFinish(); m_reportEnv.Dispose(); }
protected override void OnOpenedConnection() { LoadFromObject(m_appobj); if (m_conn != null && m_conn.IsOpened) { ProcessRegister.AddBackgroundTask("s_loading_data"); m_conn.BeginInvoke((Action)DoLoadData, Async.CreateInvokeCallback(m_invoker, LoadedData)); } else { try { Controls.ShowProgress(false, null, ControlVisibility); DoLoadData(); ShowDataInGui(); } catch (Exception e) { HandleError(e); } } }
private void Connected(IAsyncResult async) { try { m_connecting = false; m_conn.EndOpen(async); UsageStats.Usage("dbconnect", "dialect", m_conn.Dialect != null ? m_conn.Dialect.DialectName : "", "dbversion", m_conn.SystemConnection != null ? m_conn.SystemConnection.ServerVersion : "", "type", m_conn.SystemConnection != null ? m_conn.SystemConnection.GetType().FullName : m_conn.GetType().FullName); //Properties["connected"] = "1"; DispatchChangedProperties(); CallRefresh(); OnConnect(); } catch (Exception e) { Errors.Report(e); m_conn.BeginClose(Async.CreateInvokeCallback(RealNode.Invoker, (AsyncCallback)Disconnected)); CallRefresh(); } ProcessRegister.RemoveBackgroundTask("s_connect"); }
//void m_menu_Opening(object sender, System.ComponentModel.CancelEventArgs e) //{ // m_menu.Items.Clear(); // m_node.GetPopupMenu(new MenuBuilder(m_menu.Items)); //} //void m_menu_Popup(object sender, EventArgs e) //{ // //m_menu.MenuItems.Clear(); // m_menu.Items.Clear(); // m_node.GetPopupMenu(new PopupMenuBuilder(m_menu, m_tree)); //} public bool AllowExpand() { if (!m_node.AllowExpand()) { return(false); } MacroManager.ExpandNode(m_node); if (m_filledChildren) { m_node.NotifyExpanded(); return(true); } if (!m_node.PreparedChildren) { ProcessRegister.AddBackgroundTask("s_expand"); m_node.BeginLoadChildren(Async.CreateInvokeCallback(Invoker, OnPreparedExpand)); m_expanding = true; RefreshSelf(); return(false); } FillChildren(); m_node.NotifyExpanded(); return(true); }