Ejemplo n.º 1
0
        private void TwitterTL_Update()
        {
            // 認証を確認 //
            if (twitterAuth == null)
            {
                return;
            }

            try
            {
                // Twitterタイムラインを取得 //
                twitterTL = new TwitterLib.TimeLine(twitterAuth);
                twitterTL.update(twitterTLLength);

                // リストビューにツイートを表示 //
                List<ListViewItem> itemList = new List<ListViewItem>();
                ListViewItem itemx;

                for (int index = 0; index < twitterTL.Length; index++)
                {
                    itemx = new ListViewItem();

                    itemx.Text = twitterTL.getScreenName(index);
                    itemx.SubItems.Add(twitterTL.getText(index));

                    if (twitterTL.getInReplyToScreenName(index) == twitterAuth.TwitterID)
                    {
                        itemx.BackColor = Color.LightGreen;
                    }

                    if (twitterTL.getRetweeted(index) == true)
                    {
                        itemx.BackColor = Color.LightBlue;
                    }

                    itemList.Add(itemx);
                }

                // タイムラインを更新 //
                Invoke(new MethodInvoker(delegate
                {
                    Twitter_ListView_TimeLine.Items.Clear();
                    Twitter_ListView_TimeLine.Items.AddRange(itemList.ToArray());
                }));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Ejemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // 設定ファイルを読み込み //
            try
            {
                if (File.Exists(settingsFilePath) == true)
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    FileStream fs =
                        new FileStream(settingsFilePath, FileMode.Open);
                    appSettings = (Settings)bf.Deserialize(fs);
                    fs.Close();

                    twitterAuth = new TwitterLib.Authorization(twitterConsumerKey,
                        twitterConsuemrSecret,
                        appSettings.TwitterID,
                        appSettings.TwitterTokenValue,
                        appSettings.TwitterTokenSecret);
                    twitterTL = new TwitterLib.TimeLine(twitterAuth);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // フォーム //
            this.Text = this.ProductName + "  " + this.ProductVersion;

            // バージョン タブ //
            Label_ProductName.Text = this.ProductName + " Windows 版";
            Label_ProductVersion.Text = "バージョン: " + this.ProductVersion;

            System.Reflection.AssemblyDescriptionAttribute asmdc =
            (System.Reflection.AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(),
            typeof(System.Reflection.AssemblyDescriptionAttribute));

            TextBox_License.Text = asmdc.Description;

            // Twitter タブ //
            TwitterTL_ThreadStart();

            // ニコニコ動画 タブ //
            NicoVideo_ComboBox_Category.Items.AddRange(nicoVideoRanking.getCategoryList());
            NicoVideo_ComboBox_Category.SelectedIndex = 0;
            NicoVideoRanking_ThreadStart();

            // Pixiv タブ //
            Pixiv_ComboBox_CategorySearch.Items.AddRange(pixivRanking.getCategoryList());
            Pixiv_ComboBox_CategorySearch.SelectedIndex = 0;
            PixivRanking_ThreadStart();

            // 初音ミク タブ //
            HatsuneMiku_CheckBox_BGM.Enabled = Directory.Exists(Path.GetDirectoryName(hatsuneMikuBGMFilePath)) && File.Exists(hatsuneMikuBGMFilePath);
            HatsuneMiku_ThreadStart();

            // Bad Apple //
            BadApple_CheckBox_BGM.Enabled = Directory.Exists(Path.GetDirectoryName(badAppleBGMFilePath)) && File.Exists(badAppleBGMFilePath);
            BadApple_ThreadStart();

            try
            {
                // デバイスを接続 //
                myGLCD = new GraphicLCD(7, 6, 5, 4, 0, 1, 2, 3);
                myGLCD.Begin();

                // GLCDサイズを設定 //
                GLCD_top = new Size(myGLCD.Width, myGLCD.Height);
                GLCD_wide = new Size(myGLCD.Height, myGLCD.Width);

                // 起動画像を表示 //
                GLCD_Draw(new Bitmap(startupImagePath));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }