Exemplo n.º 1
0
 public override void PrepareForRebuild(KwsRebuildInfo rebuildInfo)
 {
     m_chatWindowsContent = new Dictionary<UInt32, String>();
     base.PrepareForRebuild(rebuildInfo);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Prepare the application to be rebuilt according to the
 /// parameters specified. This is called by the workspace state machine.
 /// </summary>
 public virtual void PrepareForRebuild(KwsRebuildInfo rebuildInfo)
 {
     SetDirty("rebuild");
     if (OnNeedToUpdateControl != null) OnNeedToUpdateControl(this, null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Increase the severity of the rebuild with the parameters provided. 
 /// </summary>
 public void WorsenRebuild(KwsRebuildInfo rebuildInfo)
 {
     if (rebuildInfo.DeleteCachedEventsFlag) m_kws.CoreData.RebuildInfo.DeleteCachedEventsFlag = true;
     if (rebuildInfo.DeleteLocalDataFlag) m_kws.CoreData.RebuildInfo.DeleteLocalDataFlag = true;
     m_kws.CoreData.RebuildInfo.UpgradeFlag = rebuildInfo.UpgradeFlag;
     m_kws.SetDirty();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Called when the login fails for some reason.
        /// </summary>
        public void HandleLoginFailure()
        {
            Debug.Assert(m_kws.LoginStatus == KwsLoginStatus.LoggingIn);

            // Update our state.
            UpdateStateOnLogout();

            // The events are out of sync.
            if (m_kws.KasLoginHandler.LoginResult == KwsLoginResult.OOS)
            {
                // Request a rebuild. We have to delete both the cached events and
                // the user data. This is nasty.
                if (m_kws.MainStatus == KwsMainStatus.Good || m_kws.MainStatus == KwsMainStatus.RebuildRequired)
                {
                    m_kws.MainStatus = KwsMainStatus.RebuildRequired;
                    KwsRebuildInfo rebuildInfo = new KwsRebuildInfo();
                    rebuildInfo.DeleteCachedEventsFlag = true;
                    rebuildInfo.DeleteLocalDataFlag = true;
                    WorsenRebuild(rebuildInfo);
                }
            }

            // Notify the listeners.
            Exception ex = new Exception(m_kws.KasLoginHandler.LoginResultString);
            m_kws.FireKwsSmNotif(new KwsSmNotifEventArgs(KwsSmNotif.Logout, ex));

            // Make the workspace work offline if required. The core operations
            // may have already marked the workspace for removal.
            SetUserTask(KwsTask.WorkOffline);
            RequestTaskSwitch(KwsTask.WorkOffline);
        }
Exemplo n.º 5
0
        /// <summary>
        /// This method should be called when an application fails.
        /// </summary>
        public void HandleAppFailure(KwsApp app, Exception ex)
        {
            Logging.Log(2, "Application " + app + " failed: " + ex.Message);
            Logging.LogException(ex);

            // We cannot handle application failures during task switches:
            // we are stopping the applications.
            if (m_taskSwitchFlag) Base.HandleException(ex, true);

            // Set the application exception.
            m_kws.AppException = ex;

            // Increase the severity of the rebuild required if possible.
            if (m_currentTask == KwsTask.Rebuild)
            {
                KwsRebuildInfo rebuildInfo = new KwsRebuildInfo();
                rebuildInfo.DeleteCachedEventsFlag = true;
                rebuildInfo.DeleteLocalDataFlag = true;
                WorsenRebuild(rebuildInfo);
            }

            // Run the state machine to adjust the state.
            RequestRun("application failure");
            m_kws.StateChangeUpdate(false);

            // Notify the listeners.
            m_kws.FireKwsSmNotif(new KwsSmNotifEventArgs(KwsSmNotif.AppFailure, ex));

            // Stop the workspace if required.
            SetUserTask(KwsTask.Stop);
            RequestTaskSwitch(KwsTask.Stop);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Request the rebuilding of the workspace specified.
        /// </summary>
        public void RequestRebuildKws(Workspace kws)
        {
            if (!kws.Sm.CanRebuild()) return;

            KwsRebuildInfo info = null;
            String msg = "";

            // Use the scheduled rebuild.
            if (kws.MainStatus == KwsMainStatus.RebuildRequired)
            {
                info = kws.CoreData.RebuildInfo;
                msg = "You are about to rebuild this " + Base.GetKwsString() + ".";
            }

            // Schedule a complete rebuild.
            else
            {
                info = new KwsRebuildInfo();
                info.DeleteCachedEventsFlag = true;
                info.DeleteLocalDataFlag = true;
                msg = "You are about to rebuild this" + Base.GetKwsString() + " from its initial state." +
                      Environment.NewLine +
                      "This should only be used if you experience problems with this " + Base.GetKwsString() + ".";
            }

            msg += Environment.NewLine;
            if (info.DeleteLocalDataFlag)
                msg += Environment.NewLine +
                       "WARNING: any files you modified but did not synchronize back to the server will be lost!" +
                       Environment.NewLine +
                       Environment.NewLine;
            msg += "Are you sure you want to continue?";

            DialogResult res = Misc.KwmTellUser(msg, Base.GetKwmString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res != DialogResult.Yes) return;
            if (kws.Sm.CanRebuild())
            {
                kws.Sm.SetUserTask(KwsTask.WorkOnline);
                kws.Sm.WorsenRebuild(info);
                kws.Sm.RequestTaskSwitch(KwsTask.Rebuild);
            }
        }
Exemplo n.º 7
0
        public override void PrepareForRebuild(KwsRebuildInfo rebuildInfo)
        {
            // Make sure we are idle before rebuilding the workspace.
            ResetToIdle();
            m_lstSharingSessions.Clear();

            base.PrepareForRebuild(rebuildInfo);
        }