public void ScrollToDay(DateTime date)
        {
            int k = -1;

            for (int i = 0; i < m_posts.Count; i++)
            {
                if (DateTimeHelp.ISO8601ToDateTime(m_posts[i].timestamp).Date == date)
                {
                    k = i;
                    break;
                }
            }

            if (k != -1)
            {
                dataGridView.FirstDisplayedScrollingRowIndex = k;
                m_postBS.Position = k;
            }
        }
Exemple #2
0
        private void setCalendarBoldedDates(List <Post> posts)
        {
            MonthCalendar _mc = leftArea.MonthCalendar;

            _mc.SuspendLayout();

            _mc.BoldedDates.Clear();

            foreach (Post _p in posts)
            {
                DateTime _dt = DateTimeHelp.ISO8601ToDateTime(_p.timestamp);

                if (!_mc.BoldedDates.Contains(_dt.Date))
                {
                    _mc.BoldedDates.Add(_dt.Date);
                }
            }

            _mc.ResumeLayout();

            _mc.Invalidate();
        }
        private void setCalendarDay()
        {
            Post _post = m_postBS[m_postBS.Position] as Post;

            Main.Current.setCalendarDay(DateTimeHelp.ISO8601ToDateTime(_post.timestamp).Date);
        }
Exemple #4
0
        private void bgWorkerGetAllData_DoWork(object sender, DoWorkEventArgs e)
        {
            string _firstGetCount               = "100";  //200
            string _continueGetCount            = "-100"; //200
            Dictionary <string, Post> _allPosts = new Dictionary <string, Post>();
            string _datum = string.Empty;

            MR_posts_getLatest _getLatest = null;

            try
            {
                _getLatest = RT.REST.Posts_getLatest(_firstGetCount);
            }
            catch
            {
                //Hack: Cloud ¦R¥X¿ù»~¸ê®Æ

                ForceLogout();
                m_getAllDataError = true;
                return;
            }

            if (_getLatest != null)
            {
                foreach (Post _p in _getLatest.posts)
                {
                    _allPosts.Add(_p.post_id, _p);
                    _datum = _p.timestamp;
                }

                if (_getLatest.get_count < _getLatest.total_count)
                {
                    int _remainingCount = int.MaxValue;

                    while (_remainingCount > 0)
                    {
                        _datum =
                            DateTimeHelp.ToUniversalTime_ToISO8601(DateTimeHelp.ISO8601ToDateTime(_datum).AddSeconds(1));

                        MR_posts_get _postsGet = RT.REST.Posts_get(_continueGetCount, _datum, "");

                        if (_postsGet != null)
                        {
                            foreach (Post _p in _postsGet.posts)
                            {
                                if (!_allPosts.ContainsKey(_p.post_id))
                                {
                                    _allPosts.Add(_p.post_id, _p);
                                    _datum = _p.timestamp;
                                }
                            }

                            _remainingCount = _postsGet.remaining_count;
                        }
                    }
                }
            }

            List <Post> _tmpPosts = new List <Post>();

            foreach (Post _p in _allPosts.Values)
            {
                _tmpPosts.Add(_p);
            }

            if (m_manualRefresh)
            {
                RT.SetAllCurrentGroupPostHaveRead();
            }

            RT.CurrentGroupPosts = _tmpPosts;

            if (m_manualRefresh)
            {
                SetLastReadPos();
            }

            s_logger.Info("bgWorkerGetAllData_DoWork. Get Post Count:" + _tmpPosts.Count);
        }