コード例 #1
0
        public void ShowChildPopup(FormPopup child, string href)
        {
            var id       = Convert.ToDecimal(Regex.Replace(href, "^[^0-9]*([0-9]+)/[^/]*$", "$1"));
            var user     = Regex.Replace(href, ".*/", "");
            var timeline = GetTimelineById(id);

            if (timeline == null && twitter != null && twitter.IsActive)
            {
                timeline = twitter.GetUserTimeline(user, id);
            }
            if (timeline != null)
            {
                child.SetHTML("<table id=\"tweets\">" + FormMain.TimelineToHtml(timeline) + "</table>");
                child.StartPosition = FormStartPosition.Manual;
                child.Location      = Cursor.Position;
                if (child.Right >= Screen.PrimaryScreen.Bounds.Right)
                {
                    child.Left -= child.Right - Screen.PrimaryScreen.Bounds.Right;
                }
                if (child.Bottom >= Screen.PrimaryScreen.Bounds.Bottom)
                {
                    child.Top -= child.Bottom - Screen.PrimaryScreen.Bounds.Bottom;
                }
                child.Show();
            }
        }
コード例 #2
0
ファイル: FormPopup.cs プロジェクト: Frankity/uwitter
        public void SetHTML(string html)
        {
            while (webPopup.Document.Body == null)
            {
                System.Threading.Thread.Sleep(100);
            }
            webPopup.Document.Body.InnerHtml = html;
            this.Size = webPopup.Document.Body.ScrollRectangle.Size;

            // 子供を作っておく
            if (child == null)
            {
                child = new FormPopup(main);
            }
        }
コード例 #3
0
        public FormMain()
        {
            InitializeComponent();

            this.MouseMove += new MouseEventHandler(FormMain_MouseMove);

            btnTweet.Enabled   = false;
            btnTweet.BackColor = SystemColors.ControlDark;

            since_id = null;
            if (!string.IsNullOrEmpty(Properties.Settings.Default.AccessToken) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.AccessTokenSecret) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.UserId) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.ScreenName))
            {
                this.Text = Properties.Settings.Default.ScreenName + " - " + Application.ProductName;
                twitter   = new Twitter(OAuthKey.CONSUMER_KEY, OAuthKey.CONSUMER_SECRET, Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessTokenSecret);
            }
            else
            {
                this.Text = "(未認証) - " + Application.ProductName;
                twitter   = null;
            }

            if (Properties.Settings.Default.Width != 0 && Properties.Settings.Default.Height != 0)
            {
                this.StartPosition = FormStartPosition.Manual;
                this.DesktopBounds = new Rectangle(Properties.Settings.Default.X, Properties.Settings.Default.Y, Properties.Settings.Default.Width, Properties.Settings.Default.Height);
            }

            since_id         = null;
            in_reply_to_id   = null;
            in_reply_to_name = null;
            timelines        = new List <Timeline>();
            hasRead          = false;

            webMain.Visible      = false; // 音を消すため
            webMain.DocumentText = string.Format("<html><head><style type=\"text/css\">{0}</style><script type=\"text/javascript\">{1}</script></head><body><table id=\"tweets\"></table></body></html>", Properties.Resources.css, Properties.Resources.js);

            popup = new FormPopup(this);
        }