Esempio n. 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);
            }
        }
Esempio n. 2
0
 public void Relink(KwsCoreData cd)
 {
     m_cd                  = cd;
     RootUser              = new KwsUser();
     RootUser.AdminFlag    = true;
     RootUser.ManagerFlag  = true;
     RootUser.RegisterFlag = true;
     RootUser.VirtualFlag  = true;
     RootUser.AdminName    = RootUser.UserName = "******";
 }
Esempio n. 3
0
 public void Relink(UInt64 internalID, KwsCoreData cd)
 {
     InternalID = internalID;
     Cd         = cd;
     Cd.Relink();
     Wm.KwsTree[InternalID] = this;
     Kcd = Wm.GetOrCreateKcd(Cd.Credentials.KcdID);
     Kcd.KwsTree[InternalID] = this;
     Sm.Relink(this);
     KcdEventHandler.Relink(this);
     KcdLoginHandler.Relink(this);
     Chat.Relink(this);
     Pb.Relink(this);
     Vnc.Relink(this);
     Kfs.Relink(this);
 }
Esempio n. 4
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();
        }
Esempio n. 5
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;
            }
        }
Esempio n. 6
0
 public void Relink(Workspace kws)
 {
     m_kws = kws;
     m_cd  = kws.Cd;
     m_ks  = m_cd.KcdState;
 }
Esempio n. 7
0
 public void Relink(Workspace kws)
 {
     m_kws = kws;
     m_cd = kws.Cd;
     m_ks = m_cd.KcdState;
 }
Esempio n. 8
0
        /// <summary>
        /// Deserializing constructor.
        /// </summary>
        public Workspace(SerializationInfo info, StreamingContext context)
        {
            Int32 version = info.GetInt32("WorkspaceVersion");
            InternalID = info.GetUInt64("m_internalID");

            // This is an old workspace which needs to be rebuilt.
            if (version < 5)
            {
                FileKwsDeserializer dsr = (FileKwsDeserializer)KwmSpawner.Instance.KwmDsr.CurKwsDsr;

                // Get the folder information.
                try
                {
                    dsr.FolderID = UInt64.Parse(info.GetString("m_parentFolderID").Substring(6));
                    dsr.FolderIndex = info.GetInt32("m_indexInFolder");
                }

                catch (Exception)
                {
                }

                // Update the credentials.
                CoreData.Credentials = ((Credentials)info.GetValue("credentials", typeof(Credentials))).newCreds;

                // Set the rebuild information.
                MainStatus = KwsMainStatus.RebuildRequired;
                KwsRebuildInfo rebuildInfo = CoreData.RebuildInfo;
                rebuildInfo.DeleteCachedEventsFlag = true;
                rebuildInfo.DeleteLocalDataFlag = false;
                rebuildInfo.UpgradeFlag = true;

                if (version >= 3)
                {
                    AppKfs appKfs = (AppKfs)info.GetValue("m_appKfs", typeof(AppKfs));
                    appKfs.Share.CompatLastKwsEventID = info.GetUInt64("m_lastEventID");
                    appKfs.Initialize(this);
                    AppTree[KAnpType.KANP_NS_KFS] = appKfs;
                }
            }

            // Pre-desintermediation and later.
            else
            {
                MainStatus = (KwsMainStatus)info.GetValue("MainStatus", typeof(KwsMainStatus));
                KAnpState = (KwsKAnpState)info.GetValue("KAnpState", typeof(KwsKAnpState));
                CoreData = (KwsCoreData)info.GetValue("CoreData", typeof(KwsCoreData));
                UserTask = (KwsTask)info.GetValue("UserTask", typeof(KwsTask));

                // Post-desintermediation.
                if (version >= 6)
                {
                    KasLoginHandler = (KwsKasLoginHandler)info.GetValue("KasLoginHandler", typeof(KwsKasLoginHandler));
                    AppException = (Exception)info.GetValue("AppException", typeof(Exception));
                }
            }

            // Create a temporary KAS object.
            Kas = new WmKas(CoreData.Credentials.KasID);
        }
Esempio n. 9
0
 public void Relink(UInt64 internalID, KwsCoreData cd)
 {
     InternalID = internalID;
     Cd = cd;
     Cd.Relink();
     Wm.KwsTree[InternalID] = this;
     Kcd = Wm.GetOrCreateKcd(Cd.Credentials.KcdID);
     Kcd.KwsTree[InternalID] = this;
     Sm.Relink(this);
     KcdEventHandler.Relink(this);
     KcdLoginHandler.Relink(this);
     Chat.Relink(this);
     Pb.Relink(this);
     Vnc.Relink(this);
     Kfs.Relink(this);
 }
Esempio n. 10
0
 public void Relink(KwsCoreData cd)
 {
     m_cd = cd;
     RootUser = new KwsUser();
     RootUser.AdminFlag = true;
     RootUser.ManagerFlag = true;
     RootUser.RegisterFlag = true;
     RootUser.VirtualFlag = true;
     RootUser.AdminName = RootUser.UserName = "******";
 }