/// 共有メモリアクセスオブジェクトからDirectoryを読み込む
        /// @param interprocess プロセス間通信用オブジェクト
        public void RefreshDirectory(Interprocess interprocess)
        {
            // 共有メモリにアクセス
            var initResult = interprocess.InitDirectory();

            if (!initResult)
            {
                return;
            }
            Directory directory;
            var       getResult = interprocess.GetDirectory(out directory);

            if (!getResult)
            {
                return;
            }

            // Entries/EntryLabelsを更新
            this.entries.Clear();
            this.EntryLabels.Clear();
            foreach (var entry in directory.Entries)
            {
                if (entry.ProcessID == 0)
                {
                    continue;
                }

                // InternalEntryの生成と追加
                var internalEntry = new InternalEntry(entry);
                this.entries[entry.ProcessID] = internalEntry;

                // ラベルの生成と追加
                this.EntryLabels.Add(entry.ProcessID, this.GetEntryLabel(internalEntry));
            }

            // 現在選択中のプロセスIDがなくなっていた場合
            if (!this.entries.ContainsKey(this.CurrentProcessID))
            {
                if (this.entries.Count == 0)
                {
                    this.CurrentProcessID = 0;
                }
                else
                {
                    // 適当に最初の一個を選ぶ
                    foreach (var key in this.entries.Keys)
                    {
                        this.CurrentProcessID = key;
                        break;
                    }
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: xorkrus/vk_wm
        /// <summary>
        /// Открытие приложения для просмотра событий
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void OnNotificationRightSoftKeyClick(object sender, EventArgs e)
        {
            try
            {
                var proc = new Process();
                proc.StartInfo.FileName        = SystemConfiguration.AppInstallPath + "\\VKontakteWM.exe";
                proc.StartInfo.UseShellExecute = true;
                proc.Start();

                if (NotifyAbortFlag == 1)
                {
                    DebugHelper.WriteLogEntry("Close notificator");
                    Interprocess.StopService();
                }
            }
            catch (Exception ex)
            {
                DebugHelper.WriteLogEntry(String.Format("{0}: {1}", Properties.Resources.Program_OnNtfnRSoftKey_Error, ex.Message));
            }
        }
예제 #3
0
        //===================================================================
        // コンストラクタ
        //===================================================================

        /// コンストラクタ
        public DSFMonitor(Interprocess interprocess)
        {
            this.interprocess = interprocess;
            this.interprocess.InitShutdownEvent();
        }