Beispiel #1
0
 void HConnection_RemoveByKey(RemoveConntectionByKeyArgs obj)
 {
     if (Root == null || Root.ConnPack == null)
     {
         return;
     }
     Root.ConnPack.BeginRemoveByKey(obj.ConnKey, Async.CreateInvokeCallback(m_invoker, async => RemovedConnection(async, obj.ConnKey)));
 }
Beispiel #2
0
        public void Connect()
        {
            if (!EnabledConnect())
            {
                return;
            }
            m_connecting = true;
            CallRefresh();

            ProcessRegister.AddBackgroundTask("s_connect");
            m_conn.BeginOpen(Async.CreateInvokeCallback(RealNode.Invoker, (AsyncCallback)Connected));
        }
Beispiel #3
0
 protected void CallOpen()
 {
     if (m_connFact == null)
     {
         Opened(null);
         return;
     }
     m_conn = ConnPack.GetConnection(m_connFact, true);
     if (ConnPack.IsOpened(m_connFact))
     {
         Opened(null);
     }
     else
     {
         m_conn.BeginOpen(Async.CreateInvokeCallback(m_invoker, Opened));
     }
 }
Beispiel #4
0
        void HConnection_RemoveByKey(RemoveConntectionByKeyArgs e)
        {
            if (ConnPack == null)
            {
                return;
            }
            if (!ConnPack.Contains(e.ConnKey))
            {
                return;
            }
            if (!AllowCloseConnection(e.ConnKey))
            {
                e.Canceled = true;
                return;
            }
            var async = ConnPack.BeginRemoveByKey(e.ConnKey, Async.CreateInvokeCallback(m_invoker, RemovedConnection));

            if (async.CompletedSynchronously)
            {
                RemovedConnection(async);
            }
        }
Beispiel #5
0
 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);
         }
     }
 }
Beispiel #6
0
 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");
 }
Beispiel #7
0
        //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);
        }