Example #1
0
/// <summary>
/// Dispose of the session on the services side
/// </summary>

        public static void DisposeSession()
        {
            if (NativeSessionClient != null)
            {
                NativeSessionClient.DisposeSession();
                NativeSessionClient = null;
            }

            return;
        }
Example #2
0
        /// <summary>
        /// Create session
        /// </summary>
        /// <param name="iniFile"></param>
        /// <param name="asynch"></param>

        public static void CreateSession(
            IniFile iniFile,
            string argString,
            bool asynch)
        {
            UseRemoteServices      = iniFile.ReadBool("UseMobiusServices", true);
            DebugNativeSessionHost = iniFile.ReadBool("DebugNativeSessionHost", false);

            if (UseRemoteServices)
            {
                NativeSessionClient = new NCNS.NativeSessionClient();
                NativeSessionClient.CreateSession(iniFile, asynch);
                return;
            }

            else                     // if not using services just do Initialize
            {
                try
                {
                    _inCreateSessionStandAlone = true;

                    string servicesIniFileName = iniFile.Read("ServicesIniFile");                             // services inifile name
                    if (Lex.IsNullOrEmpty(servicesIniFileName))
                    {
                        throw new Exception("MobiusServices IniFile not defined");
                    }
                    UalUtil.Initialize(servicesIniFileName);

                    string msg = "Standalone Session started on " + Environment.MachineName + " in process " + Process.GetCurrentProcess().Id + " at " + DateTime.Now + ", ParmString: " + argString;
                    DebugLog.Message(msg);                             // log initial message
                    _sessionCreatedStandAlone = true;
                }
                finally { _inCreateSessionStandAlone = false; }

                return;
            }
        }
Example #3
0
/// <summary>
/// Get new data & update grid
/// </summary>

        void UpdateGrid()
        {
            InUpdateGrid = true;

            ServiceHostInfo svcInf = ServiceFacade.ServiceFacade.GetServiceHostInfo();

            if (svcInf == null)
            {
                return;
            }

            List <Mobius.NativeSessionClient.SessionInfo> sil = new Mobius.NativeSessionClient.NativeSessionClient().GetSessionInfoForAllSessions();

            if (sil == null)
            {
                sil = new List <SessionInfo>();
            }

            Label.Text =
                "Server: " + svcInf.ServerName +
                ", Version: " + VersionMx.FormatVersion(svcInf.Version) +
                ", Count: " + sil.Count;

            DataTable.Rows.Clear();
            DateTime now = DateTime.Now;

            foreach (SessionInfo si in sil)
            {
                DataRow dr = DataTable.NewRow();
                dr["SessionIdCol"]   = si.Id;
                dr["IsNonNativeCol"] = si.Native ? "" : "Y";
                dr["UserIdCol"]      = si.UserId;
                try { dr["UserNameCol"] = SecurityUtil.GetShortPersonNameReversed(si.UserId); }
                catch { }

                dr["CreationDtCol"] = CommandLine.FormatTimeSpan(now.Subtract(si.CreationDT));

                if (!si.ExpirationDT.Equals(DateTime.MinValue))                 // calc idle time
                {
                    dr["IdleTimeCol"] = CommandLine.FormatTimeSpan(now.Subtract(si.ExpirationDT));
                }

                if (si.ProcessId > 0)
                {
                    dr["ProcessIdCol"] = si.ProcessId;
                }

                if (si.CpuTimeSecs > 0)
                {
                    dr["CpuTimeCol"] = (int)si.CpuTimeSecs;
                }

                if (si.MemoryMb > 0)
                {
                    dr["MemoryCol"] = si.MemoryMb;
                }

                if (si.Threads > 0)
                {
                    dr["ThreadsCol"] = si.Threads;
                }

                if (si.Handles > 0)
                {
                    dr["HandlesCol"] = si.Handles;
                }

                DataTable.Rows.Add(dr);
            }

            Grid.DataSource = DataTable;
            Grid.Refresh();
            Application.DoEvents();

            InUpdateGrid = false;
            return;
        }