Exemple #1
0
 public bool GetMarkData(DateTime dt, ref MarkData md)
 {
     if (_mkDatas.ContainsKey(dt))
     {
         md = _mkDatas[dt];
         return(true);
     }
     return(false);
 }
Exemple #2
0
        public bool SetMarkData(DateTime dt, MarkData mk)
        {
            if (MkFileMgr.SetMarkData(dt, mk))
            {
                return(true);
            }
            var rootDir = GetRootDirByPath(GetMinutePath(dt));

            return(MkFileMgr.AddMarkData(dt, mk, rootDir));
        }
Exemple #3
0
 public bool SetMarkData(DateTime dt, MarkData md)
 {
     if (!_mkDatas.ContainsKey(dt))
     {
         _mkDatas.Add(dt, md);
         return(true);
     }
     _mkDatas[dt] = md;
     return(true);
 }
Exemple #4
0
        private void UpdateFilesList_ByArr(List <string> fileArr)
        {
            listFiles.Items.Clear();
            listFiles.Groups.Clear();
            listFiles.ShowGroups = true;
            var maxShow  = 1000;
            var iIndexed = 0;

            for (var i = 0; i < fileArr.Count; i++)
            {
                if (!File.Exists(fileArr[i]))
                {
                    fileArr.RemoveAt(i);
                    i--;
                    i = Math.Max(i, 0);
                    continue;
                }
                var dt = FileOperator.FileTool.GetDtMinByPath(fileArr[i]);
                var mk = new MarkData();
                FileOperator.FileTool.GetMarkData(dt, ref mk);
                var bCheckShow = CheckShow(dt, mk);
                if (!bCheckShow)
                {
                    continue;
                }

                if (iIndexed < maxShow)
                {
                    iIndexed++;
                    var gpName = string.Format("{0:4D}-{1:2D}-{2:2D}", dt.Year, dt.Month, dt.Day);
                    gpName = dt.ToString("yyyy-MM-dd");
                    var fileName = dt.ToString("yyyy-MM-dd HH:mm");

                    var lvi = new ListViewItem();
                    lvi.Text = fileName;
                    lvi.SubItems.Add(mk.MarkDataStr);
                    lvi.SubItems.Add(mk.Description);
                    lvi.SubItems.Add(fileArr[i]);
                    var gp = GetGroup(gpName);
                    gp.Items.Add(lvi);
                    listFiles.Items.Add(lvi);
                }
                else
                {
                    break;
                }
            }
            var msg = string.Format("显示文件:{0}/{1} ", Math.Min(maxShow, iIndexed), fileArr.Count);

            if (iIndexed > maxShow)
            {
                msg += string.Format("符合条件的文件数过多({0}>{1}),列表仅显示了前{1}条,请缩小搜索范围!", iIndexed, maxShow, maxShow);
            }
            tssLabel.Text = msg;
        }
Exemple #5
0
        private void SaveMarkData()
        {
            if (!IsNowValid())
            {
                return;
            }
            var mk = new MarkData();

            mk.Description = tbNote.Text;
            mk.ToDelete    = picBin.Visible;
            mk.Favourite   = picLove.Visible;
            mk.Private     = picPriv.Visible;
            _fileParseTool.SetMarkData(_curDt, mk);
        }
Exemple #6
0
        public bool GetMarkData(DateTime dt, ref MarkData mkDa)
        {
            var dtMonth = new DateTime(dt.Year, dt.Month, 1);

            var mkf = new MarkFile(dtMonth);

            if (BFindMarkFile(dt, ref mkf))
            {
                if (mkf.GetMarkData(dt, ref mkDa))
                {
                    return(true);
                }
            }


            return(false);
        }
Exemple #7
0
 public bool SetMarkData(DateTime dt, MarkData mkDa)
 {
     try
     {
         var dtMonth = new DateTime(dt.Year, dt.Month, 1);
         var mkf     = new MarkFile(dtMonth);
         if (BFindMarkFile(dtMonth, ref mkf)) //need add to mkf list
         {
             mkf.SetMarkData(dt, mkDa);
             return(true);
         }
     }
     catch (Exception)
     {
         // ignored
     }
     return(false);
 }
Exemple #8
0
        private void UpdateMarkData()
        {
            var mk = new MarkData();

            if (_fileParseTool.GetMarkData(_curDt, ref mk))
            {
                tbNote.Text     = mk.Description;
                picBin.Visible  = mk.ToDelete;
                picLove.Visible = mk.Favourite;
                picPriv.Visible = mk.Private;
                picNote.Visible = mk.Describ;
            }
            else if (!ck_ContinuMark.Checked)
            {
                tbNote.Text     = string.Empty;
                picBin.Visible  = false;
                picLove.Visible = false;
                picPriv.Visible = false;
                picNote.Visible = false;
            }
        }
Exemple #9
0
 public bool AddMarkData(DateTime dt, MarkData mkDa, string mkFileRootDir)
 {
     try
     {
         var dtMonth = new DateTime(dt.Year, dt.Month, 1);
         var mkf     = new MarkFile(dtMonth);
         if (!BFindMarkFile(dtMonth, ref mkf)) //need add to mkf list
         {
             var mkFilePath = Path.Combine(mkFileRootDir, SkewkyMark + mkf.GetMarkFileName());
             mkf.FilePath = mkFilePath;
             mkf.SetMarkData(dt, mkDa);
             MarkFiles.Add(mkf);
             return(true);
         }
     }
     catch (Exception)
     {
         // ignored
     }
     return(false);
 }
Exemple #10
0
        private void updateMinute_Marks(Graphics g, DateTime nowdt, int drawWidth, Point drawPt, int height)
        {
            var drawPt1 = drawPt;

            drawPt1.Y += height;
            var markHeight = height / 5;

            var mk  = new MarkData();
            var clr = _cfsettings.MyColors.ClrNormal;

            _fileParseTool.GetMarkData(nowdt, ref mk);


            //Favourite
            drawPt1    = drawPt;
            drawPt1.Y += markHeight;
            clr        = mk.Favourite ? _cfsettings.MyColors.ClrFavorite : _cfsettings.MyColors.ClrNormal;
            g.DrawLine(new Pen(clr, drawWidth), drawPt, drawPt1);
            drawPt1.Y += 1;

            //ToDelete
            drawPt     = drawPt1;
            drawPt1.Y += markHeight;
            clr        = mk.ToDelete ? _cfsettings.MyColors.ClrToDelete : _cfsettings.MyColors.ClrNormal;
            g.DrawLine(new Pen(clr, drawWidth), drawPt, drawPt1);
            drawPt1.Y += 1;

            //Private
            drawPt     = drawPt1;
            drawPt1.Y += markHeight;
            clr        = mk.Private ? _cfsettings.MyColors.ClrPrivate : _cfsettings.MyColors.ClrNormal;
            g.DrawLine(new Pen(clr, drawWidth), drawPt, drawPt1);
            drawPt1.Y += 1;

            //Description
            drawPt     = drawPt1;
            drawPt1.Y += markHeight;
            clr        = mk.Describ ? _cfsettings.MyColors.ClrDescrib : _cfsettings.MyColors.ClrNormal;
            g.DrawLine(new Pen(clr, drawWidth), drawPt, drawPt1);
        }
Exemple #11
0
 private bool CheckShow(DateTime dt, MarkData mk)
 {
     if (dt < _dtS)
     {
         return(false);
     }
     if (dt > _dtE)
     {
         return(false);
     }
     if (!_bLove && mk.Favourite)
     {
         return(false);
     }
     if (!_bDel && mk.ToDelete)
     {
         return(false);
     }
     if (!_bPriv && mk.Private)
     {
         return(false);
     }
     if (!_bNote && mk.Describ)
     {
         return(false);
     }
     if (!_bNormal && !(mk.Favourite || mk.ToDelete || mk.Private || mk.Describ))
     {
         return(false);
     }
     if (string.IsNullOrEmpty(_keyWord))
     {
         return(true);
     }
     if (!mk.Describ || !mk.Description.Contains(_keyWord))
     {
         return(false);
     }
     return(true);
 }
Exemple #12
0
        private void pBmin_MouseMove(object sender, MouseEventArgs e)
        {
            var height    = pBmin.Height;
            var width     = pBmin.Width;
            var drawWidth = width / 60;
            var clkPt     = new Point(e.Location.X, e.Location.Y);

            clkPt.Y += height;
            var clkMinute = clkPt.X / drawWidth;

            clkMinute = Math.Min(clkMinute, 59);
            var dispDt = new DateTime(_curDt.Year, _curDt.Month, _curDt.Day,
                                      _curDt.Hour, clkMinute, _curDt.Second);

            //if (_curDt.Minute != clkMinute)
            //{
            var msg = string.Format("{0}/{1:D2}/{2:D2} {3:D2}:{4:D2}",
                                    _curDt.Year, _curDt.Month, _curDt.Day,
                                    _curDt.Hour, clkMinute);
            //toolTip1.SetToolTip(this.pBmin, msg);
            //    toolTip1.Show(msg, pBmin, clkPt, 3);
            //}//
            var mk = new MarkData();

            if (_fileParseTool.GetMarkData(dispDt, ref mk) &&
                mk.Describ)
            {
                msg          = "[" + msg + "] " + mk.Description;
                msg          = msg.Replace("\n", " ");
                msg          = msg.Replace("\r", " ");
                tssNote.Text = msg;
            }
            else
            {
                tssNote.Text = "";
            }
        }
Exemple #13
0
 public bool GetMarkData(DateTime dt, ref MarkData mk)
 {
     return(MkFileMgr.GetMarkData(dt, ref mk));
 }