예제 #1
0
        //コミュ登録
        private async void button1_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                return;
            }

            var ttt = Comm.GetChNo(textBox1.Text);

            if (string.IsNullOrEmpty(ttt))
            {
                AddLog("正しいコミュを登録してください。", 3);
                return;
            }
            if (lists_c.Count(x => x.ComId == ttt) > 0)
            {
                AddLog("そのコミュは登録済です。", 3);
                return;
            }
            //コミュの存在チェック、コミュ名をゲット
            string ttt2;

            using (var nnn = new NicoLiveNet())
            {
                if (ttt.IndexOf("co") > -1)
                {
                    ttt2 = await nnn.GetCommNameAsync(ttt);
                }
                else
                {
                    ttt2 = await nnn.GetChNameAsync(ttt);
                }
            }
            if (string.IsNullOrEmpty(ttt2))
            {
                AddLog("そのコミュは存在しません。", 3);
                return;
            }

            //コミュを登録
            var comm = new Comm();

            comm.Clear();
            comm.ComId       = ttt;
            comm.ComName     = ttt2;
            comm.Regist_Date = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            lists_c.Add(comm);
            textBox1.Text = "";
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                //設定データーの読み込み
                props = new Props();
                props.LoadData();
                if (!Directory.Exists(Props.GetSettingDirectory()))
                {
                    props.SaveData();
                }

                Popup.InitPopi();

                //最小化して起動する
                if (props.IsMinimization)
                {
                    this.WindowState   = FormWindowState.Minimized;
                    this.ShowInTaskbar = false;
                }

                LogFile    = Props.GetLogfile(Props.GetSettingDirectory(), "imasaraalert");
                dbfilecomm = Path.Combine(Props.GetApplicationDirectory(), Props.CommDb);
                dbfileuser = Path.Combine(Props.GetApplicationDirectory(), Props.UserDb);

                //データー読み込み
                ReadAllData();

                _nLiveNet = new NicoLiveNet();
                //アラートに接続
                StartAlert();
            }
            catch (Exception Ex)
            {
                AddLog("アラート接続エラー\r\n" + Ex.Message, 2);
            }
        }