예제 #1
0
        /// <summary>
        /// Create a new workspace having the credentials specified and insert
        /// it in the workspace manager, with the current task Stop.
        /// </summary>
        public static Workspace CreateWorkspace(KwsCredentials creds)
        {
            try
            {
                // Clear the public flag if we already have a public workspace.
                if (Cd.PublicKwsID != 0)
                {
                    creds.PublicFlag = false;
                }

                // Get a new internal ID.
                UInt64 internalID = Cd.NextKwsInternalID++;

                // Register the worskpace in the workspace manager.
                KwsCoreData kwsCd = new KwsCoreData();
                kwsCd.Credentials = creds;
                Workspace kws = new Workspace();
                kws.Relink(internalID, kwsCd);
                AdjustPublicKwsID();

                // Insert the workspace in the workpace list in the database.
                LocalDbBroker.AddKwsToKwsList(kws.InternalID, kws.Cd.Credentials.KwsName);

                // The WM state has changed.
                Wm.OnStateChange(WmStateChange.Permanent);

                return(kws);
            }

            catch (Exception ex)
            {
                KBase.HandleException(ex, true);
                return(null);
            }
        }
예제 #2
0
        public static void Relink(WmDeserializer ds)
        {
            Cd = ds.WmCd;
            WmSm.Relink();
            KcdBroker.OnEvent            += WmSm.HandleKcdBrokerNotification;
            KmodBroker.OnThreadCollected += WmSm.OnThreadCollected;
            EAnpBroker.OnClose           += WmSm.OnThreadCollected;
            EAnpBroker.OnChannelOpen     += WmEAnp.HandleChannelOpen;

            foreach (UInt64 internalID in ds.KwsCdList.Keys)
            {
                Workspace   kws   = new Workspace();
                KwsCoreData kwsCd = ds.KwsCdList[internalID];
                kws.Relink(internalID, kwsCd);
            }

            AdjustPublicKwsID();
        }
예제 #3
0
        public static void Relink(WmDeserializer ds)
        {
            Cd = ds.WmCd;
            WmSm.Relink();
            KcdBroker.OnEvent += WmSm.HandleKcdBrokerNotification;
            KmodBroker.OnThreadCollected += WmSm.OnThreadCollected;
            EAnpBroker.OnClose += WmSm.OnThreadCollected;
            EAnpBroker.OnChannelOpen += WmEAnp.HandleChannelOpen;

            foreach (UInt64 internalID in ds.KwsCdList.Keys)
            {
                Workspace kws = new Workspace();
                KwsCoreData kwsCd = ds.KwsCdList[internalID];
                kws.Relink(internalID, kwsCd);
            }

            AdjustPublicKwsID();
        }
예제 #4
0
        /// <summary>
        /// Create a new workspace having the credentials specified and insert
        /// it in the workspace manager, with the current task Stop.
        /// </summary>
        public static Workspace CreateWorkspace(KwsCredentials creds)
        {
            try
            {
                // Clear the public flag if we already have a public workspace.
                if (Cd.PublicKwsID != 0) creds.PublicFlag = false;

                // Get a new internal ID.
                UInt64 internalID = Cd.NextKwsInternalID++;

                // Register the worskpace in the workspace manager.
                KwsCoreData kwsCd = new KwsCoreData();
                kwsCd.Credentials = creds;
                Workspace kws = new Workspace();
                kws.Relink(internalID, kwsCd);
                AdjustPublicKwsID();

                // Insert the workspace in the workpace list in the database.
                LocalDbBroker.AddKwsToKwsList(kws.InternalID, kws.Cd.Credentials.KwsName);

                // The WM state has changed.
                Wm.OnStateChange(WmStateChange.Permanent);

                return kws;
            }

            catch (Exception ex)
            {
                KBase.HandleException(ex, true);
                return null;
            }
        }