private void UploadTasks()
        {
            lock (m_WaitingServerTasks)
            {
                if (m_WaitingServerTasks.Count > 0)
                {
                    log.Debug("Start Uploading..." + m_WaitingServerTasks.Count.ToString());

                    List <IRemoteTask> tl = new List <IRemoteTask>();

                    while (m_WaitingServerTasks.Count > 0)
                    {
                        tl.Add(m_WaitingServerTasks.Dequeue());
                    }

                    if (!ConnectionManagerClient.TTMSendBackTasks(tl))
                    {
                        foreach (IRemoteTask t in tl)
                        {
                            m_WaitingServerTasks.Enqueue(t);
                        }
                    }
                    else
                    {
                        foreach (IRemoteTask t in tl)
                        {
                            t.Dispose();
                        }
                    }
                }
            }
        }
        public static void RegisterTcpChannelForClient()
        {
            if (ConnectionManagerClient.IsTcpChannelRegistered)
            {
                ConnectionManagerClient.UnregisterChannel();
            }

            //Init Tcp Channel
            log.Info("Init Tcp Channel...");
            ConnectionManagerClient.RegisterTcpChannel();
        }
        public static void Dispose(FrmMain uiform)
        {
            if (ms_IsClientRunning)
            {
                Stop();
            }

            Thread.Sleep(500);

            ConnectionManagerClient.UnregisterChannel();

            StoreManagerIntoFile(uiform);

            ms_tmc.Dispose();

            //Static Manager Disposing...
            VBAStaticEngine.DisposeAll();
            CWBPool.Dispose();
            PerformanceBalancer.Dispose();
        }
Пример #4
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            // Log an info level message
            log.Info("Application [" + System.Reflection.Assembly.GetEntryAssembly().GetName().Name + "] Start");

            //Init
            ClientControlManager.Init(this);

            //Init ServerStatusMonitor
            ServerStatusMonitor.Init(this, this.labelServerStatus);

            //Refresh Application Interface
            RefreshClientControl();
            RefreshMode();

            //Refresh Server Status
            ConnectionManagerClient.FetchServerStatus();

            //Show Vision
            this.Text = this.Text + " - " + Application.ProductVersion;
        }
        private Domain GetDomainFromServer(string domainGUID)
        {
            Domain d = null;

            try
            {
                IDomainTransmissionManager mgr = ConnectionManagerClient.GetDomainTransmissionManager();
                d = mgr.GetDomain(domainGUID);
                return(d);
            }
            catch (NullReferenceException e)
            {
                log.Error("尝试下载一个不存在的Domian", e);
                return(d);
            }
            catch (Exception e)
            {
                log.Error("GetDomainFromServer未知错误: ", e);
                return(d);
            }
        }
        private void DownloadTasks()
        {
            BaseVBAScriptTask bt = null;

            if (m_WaitingLocalTasks.Count <= m_SingerTransportation)
            {
                log.Debug("Start Download...");
                List <IRemoteTask> ts = ConnectionManagerClient.TTMFeachTasks(m_SingerTransportation);
                if (ts != null && ts.Count > 0)
                {
                    foreach (IRemoteTask t in ts)
                    {
                        bt = t as BaseVBAScriptTask;
                        if (DomainManager.IsDomainNeedUpdated(bt.DomainGUID, bt.TimeStamp))
                        {
                            Domain d = GetDomainFromServer(bt.DomainGUID);
                            if (d != null)
                            {
                                DomainManager.AddDomain(d);
                                log.Debug("Fetching A Domain for " + t.Name);
                            }
                            else
                            {
                                log.Debug("Weird DomainGUID With No Domian IN SERVER!:" + bt.DomainGUID);
                            }
                        }
                        this.AddTask(t);
                        log.Debug("Fetching one " + t.Name);
                    }
                }
                else
                {
                    log.Debug("No avaible remotetask for downloading...");
                }
            }
        }
 private void RefreshServerStatus()
 {
     ConnectionManagerClient.FetchServerStatus();
 }