Пример #1
0
        public void PerformQuery()
        {
            // Start listening to the workspace status events.
            RegisterToKws(false);

            m_opStep = KwmCoreKwsOpStep.SetUserPwd;
            AnpMsg msg = m_kws.NewKAnpCmd(KAnpType.KANP_CMD_MGT_SET_USER_PWD);
            msg.AddUInt32(m_targetUserId);
            msg.AddString(m_stringParam);
            m_query = m_kws.PostNonAppKasQuery(msg, null, HandleSetUserPwdResponse, true);

            if (m_frmPleaseWait.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                Cancel(true, "");
        }
Пример #2
0
 /// <summary>
 /// Helper for PostNonAppKasQuery() and PostKasQuery().
 /// </summary>
 private WmKasQuery PostKasQueryInternal(AnpMsg cmd, Object[] metaData, KasQueryDelegate callback, KwsApp app,
     bool clearOnLogoutFlag)
 {
     WmKasQuery query = new WmKasQuery(cmd, metaData, callback, Kas, this, app, clearOnLogoutFlag);
     m_wm.Sm.PostKasQuery(query);
     return query;
 }
Пример #3
0
 /// <summary>
 /// Post the KAS query specified.
 /// </summary>
 public void PostKasQuery(WmKasQuery query)
 {
     Debug.Assert(!query.Kas.QueryMap.ContainsKey(query.MsgID));
     query.Kas.QueryMap[query.MsgID] = query;
     m_wm.UiBroker.OnAnpMsgTransfer(query.Kas, query.Cmd);
     m_wkb.SendAnpMsgToKcm(new KcmAnpMsg(query.Cmd, query.Kas.KasID));
 }
Пример #4
0
        /// <summary>
        /// Clean up the operation when it has completed.
        /// </summary>
        private void CleanUpOnDone()
        {
            if (m_doneFlag) return;
            m_doneFlag = true;

            UnregisterFromKws(false);

            if (m_query != null)
            {
                m_query.Cancel();
                m_query = null;
            }

            if (m_frmPleaseWait != null)
            {
                m_frmPleaseWait.Close();
                m_frmPleaseWait.Dispose();
                m_frmPleaseWait = null;
            }
        }
Пример #5
0
        private void HandleSetUserPwdResponse(KasQuery ctx)
        {
            if (!CheckCtx(KwmCoreKwsOpStep.SetUserPwd)) return;
            Debug.Assert(m_query == ctx);
            m_query = null;

            // FIXME if version >= 4 check against KANP_RES_KWS_PROP_CHANGE
            if (ctx.Res.Type == KAnpType.KANP_RES_OK)
            {
                m_kws.PostGuiExecRequest(new SetPwdGer(MessageBoxIcon.Information,
                                                       "The new password has been set."));

                // We have changed our own password. Save it.
                if (m_kws.CoreData.Credentials.UserID == m_targetUserId)
                {
                    m_kws.CoreData.Credentials.Pwd = m_stringParam;
                    m_kws.SetDirty();
                }
            }

            else
            {
                try
                {
                    String msg = "Unable to set the new password: " + ctx.Res.Elements[1].String;
                    ReportFailureToUser(msg);
                }

                catch (Exception ex)
                {
                    HandleMiscFailure(ex);
                    return;
                }
            }

            CleanUpOnDone();
        }
Пример #6
0
        /// <summary>
        /// Handle an ANP reply received from the KAS.
        /// </summary>
        public void HandleAnpReply(WmKasQuery query)
        {
            try
            {
                // Call the callback.
                query.Callback(query);
            }

            catch (Exception ex)
            {
                // The network handler throws if the KAS sends us garbage.
                if (query.App == null) BlameKas(ex);

                // Blame the application.
                else HandleAppFailure(query.App, ex);
            }
        }