Exemplo n.º 1
0
        private void ConfigForm_Load(object sender, EventArgs e)
        {
            Log.Logger.Debug("設定画面読み込み");

            configItems = ConfigItem.Load();

            List <ListViewItem> configListItem = new List <ListViewItem>();

            if (configItems.Count > 0)
            {
                foreach (ConfigItem item in configItems)
                {
                    string[] data = new string[] {
                        item.Name,
                        item.GetTiming(),
                        item.GetCommand(),
                        item.Enable.ToString()
                    };

                    configListItem.Add(new ListViewItem(data));
                }

                configListView.Items.AddRange(configListItem.ToArray());
                SelectIndex = 0;
                configListView.Items[SelectIndex].Selected = true;
            }
        }
Exemplo n.º 2
0
        private void fileWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            Log.Logger.Info("設定ファイル更新検知");

            lock (configItems)
            {
                configItems = ConfigItem.Load();
            }
            Log.Logger.Info("設定ファイル反映完了");
        }
Exemplo n.º 3
0
        public Cron()
        {
            Log.Logger.Debug("監視スレッド起動準備");

            configItems = ConfigItem.Load();

            fileWatcher = new FileSystemWatcher();
            fileWatcher.NotifyFilter        = NotifyFilters.LastWrite;
            fileWatcher.Path                = Path.GetDirectoryName(Path.GetFullPath(Properties.Resources.CronFile));
            fileWatcher.Filter              = Path.GetFileName(Properties.Resources.CronFile);
            fileWatcher.Changed            += new FileSystemEventHandler(fileWatcher_Changed);
            fileWatcher.EnableRaisingEvents = true;

            tokenSource = new CancellationTokenSource();
            cancelToken = tokenSource.Token;

            cronTask = new Task <bool>(cronThread);

            cronTask.Start();

            Log.Logger.Debug("監視スレッド起動開始");
        }