Beispiel #1
0
        /// <summary>
        /// Import the workspace specified.
        /// </summary>
        public static void ImportKws(KwsCredentials creds)
        {
            Workspace kws = Wm.GetKwsByExternalID(creds.KcdID, creds.ExternalID);

            if (kws != null)
            {
                ImportExistingKws(kws, creds);
            }
            else
            {
                ImportNewKws(creds);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Called when the create workspace command reply is received.
        /// </summary>
        private void HandleCreateKwsCmdResult(KcdQuery query)
        {
            if (m_kcdQuery != query)
            {
                return;
            }
            m_kcdQuery = null;
            Debug.Assert(m_step == OpStep.CreateReply);

            try
            {
                AnpMsg res = query.Res;

                // Failure.
                if (res.Type != KAnp.KANP_RES_MGT_KWS_CREATED)
                {
                    throw EAnpException.FromKAnpReply(res);
                }

                // Parse the reply.
                UInt64 externalID = res.Elements[0].UInt64;
                String emailID    = res.Elements[1].String;

                // Validate that the KCD is not screwing with us. This can
                // happen if the KCD state has been reverted.
                if (Wm.GetKwsByExternalID(Kws.Kcd.KcdID, externalID) != null)
                {
                    throw new Exception("duplicate " + KwmStrings.Kws + " external ID");
                }

                // Update the workspace credentials.
                Creds.ExternalID = externalID;
                Creds.EmailID    = emailID;

                // Wait for login.
                m_step = OpStep.LoggingIn;
                Kws.Sm.SetLoginType(KwsLoginType.Cached);
                Kws.Sm.SetSpawnStep(KwsSpawnTaskStep.Login);
            }

            catch (Exception ex)
            {
                HandleFailure(ex);
            }
        }