Exemple #1
0
 void SetStatistical(Data.ShowData SD, TimeSpan TotalTime, TimeSpan ThisTime, TimeSpan FishTime, bool DivideByTitle)
 {
     if (SD == null)
     {
         DivideByTitleTextBlock.Text    = null;
         CatchFishTextBlock.Text        = null;
         ThisTimeTextBlock.Text         = null;
         ThisTotalTimeTextBlock.Text    = null;
         TotalTimeTextBlock.Text        = null;
         ThisPercentTextBlock.Text      = null;
         ThisTotalPercentTextBlock.Text = null;
         ActionNameTextBlock.Text       = null;
         TitleTextBlock.Text            = null;
         CatchFishTimeTextBlock.Text    = null;
         CatchFishPercentTextBlock.Text = null;
         return;
     }
     DivideByTitleTextBlock.Text    = DivideByTitle ? "是" : "否";
     CatchFishTextBlock.Text        = SD.IsCatchFish ? "是" : "否";
     ThisTimeTextBlock.Text         = Consts.TimeSpan2String(new TimeSpan(SD.Ticks));
     ThisTotalTimeTextBlock.Text    = Consts.TimeSpan2String(ThisTime);
     TotalTimeTextBlock.Text        = Consts.TimeSpan2String(TotalTime);
     ThisPercentTextBlock.Text      = (100.0 * SD.Ticks / TotalTime.Ticks).ToString("F3") + "%";
     ThisTotalPercentTextBlock.Text = (100.0 * ThisTime.Ticks / TotalTime.Ticks).ToString("F3") + "%";
     ActionNameTextBlock.Text       = Consts.GetFileName(SD.Action);
     TitleTextBlock.Text            = SD.Title;
     CatchFishTimeTextBlock.Text    = Consts.TimeSpan2String(FishTime);
     CatchFishPercentTextBlock.Text = (100.0 * FishTime.Ticks / TotalTime.Ticks).ToString("F3") + "%";
 }
 public ListStackPanelItem(Data.ShowData SD)
 {
     InitializeComponent();
     IconImage.Source        = Consts.ChangeBitmapToImageSource(SD.I.ToBitmap());
     StartTimeTextBlock.Text = "开始时间:" + SD.Start.ToString(Consts.DateTimeFormatString);
     EndTimeTextBlock.Text   = "结束时间:" + SD.End.ToString(Consts.DateTimeFormatString);
     ActionTextBlock.Text    = Consts.GetFileName(SD.Action);
     FullFileName            = SD.Action;
     TitleTextBlock.Text     = SD.Title;
 }
Exemple #3
0
        void DataMouseEnter(object sender, MouseEventArgs e)
        {
            ClickInData = false;
            DataLeave();
            string a = "", t = "";
            bool   liststackpanelin = false;
            int    id;

            if (sender is ListStackPanelItem)
            {
                var LSP = sender as ListStackPanelItem;
                liststackpanelin = true;
                a  = LSP.FullFileName;
                t  = LSP.TitleTextBlock.Text;
                id = (int)LSP.Tag;
            }
            else
            {
                id = (int)(sender as FrameworkElement).Tag;
                if (id < 0)
                {
                    a = SectorDataList[-id - 1].Action;
                    t = SectorDataList[-id - 1].Title;
                }
                else
                {
                    a = ShowDataList[id].Action;
                    t = ShowDataList[id].Title;
                }
            }
            //Debug.Write(a + "|" + t + "|" + liststackpanelin);
            LastDataId = id;
            if (id < 0)
            {
                for (int i = 0; i < ShowDataList.Count; i++)
                {
                    if (ShowDataList[i].Action == a && ShowDataList[i].Title == t)
                    {
                        LastDataId = i;
                        break;
                    }
                }
            }
            CatchFishButton.Content = ShowDataList[LastDataId].IsCatchFish ? "设为工作任务" : "设为摸鱼任务";
            if (!liststackpanelin)
            {
                if (id >= 0)
                {
                    var nowitem = ListStackPanel.Children[id] as ListStackPanelItem;
                    nowitem.AddTransform();
                    var dis = nowitem.TranslatePoint(new System.Windows.Point(0, 0), ListStackPanel).Y;
                    ListScrollViewer.ScrollToVerticalOffset(dis);
                }
                else
                {
                    var moved = false;
                    foreach (ListStackPanelItem item in ListStackPanel.Children)
                    {
                        if (item.FullFileName == a && item.TitleTextBlock.Text == t)
                        {
                            item.AddTransform();
                            if (!moved)
                            {
                                moved = true;
                                var dis = item.TranslatePoint(new System.Windows.Point(0, 0), ListStackPanel).Y;
                                ListScrollViewer.ScrollToVerticalOffset(dis);
                            }
                        }
                    }
                }
            }
            else
            {
                var nowitem = ListStackPanel.Children[id] as ListStackPanelItem;
                nowitem.AddTransform();
            }
            if (liststackpanelin)
            {
                RectanglePathList[id].AddTransform();
            }
            else
            {
                for (var i = 0; i < ShowDataList.Count; i++)
                {
                    if (ShowDataList[i].Action == a && ShowDataList[i].Title == t)
                    {
                        RectanglePathList[i].AddTransform();
                    }
                }
            }
            for (int i = 0; i < SectorDataList.Count; i++)
            {
                if (SectorDataList[i].Action == a && SectorDataList[i].Title == t)
                {
                    SectorPathList[i].AddTransform();
                }
            }
            Data.ShowData SD        = null;
            if (id >= 0)
            {
                SD = ShowDataList[id];
            }
            else
            {
                for (var i = 0; i < ShowDataList.Count; i++)
                {
                    if (ShowDataList[i].Action == a && ShowDataList[i].Title == t)
                    {
                        SD = ShowDataList[i];
                        break;
                    }
                }
            }
            TimeSpan totaltime = ShowDataList.Last().End - ShowDataList[0].Start;
            TimeSpan thistime  = new TimeSpan();

            foreach (var i in SectorDataList)
            {
                if (i.Action == a & i.Title == t)
                {
                    thistime = new TimeSpan(i.Ticks);
                }
            }
            TimeSpan fishtime = new TimeSpan(0);

            foreach (var i in ShowDataList)
            {
                if (i.IsCatchFish)
                {
                    fishtime += new TimeSpan(i.Ticks);
                }
            }
            SetStatistical(SD, totaltime, thistime, fishtime, true);
        }
Exemple #4
0
        double GetShowData()
        {
            ShowDataList.Clear();
            SectorDataList.Clear();
            Consts.ResetNextBrush();

            var Actions = Data.GetActions(StartYMDTextBlock.Text + " " + StartHMSTextBlock.Text, EndYMDTextBlock.Text + " " + EndHMSTextBlock.Text);

            var lastmove = new DateTime(0);

            if (Actions.Count > 0)
            {
                lastmove = Actions[0].DateTime;
            }
            foreach (var a in Actions)
            {
                Data.ShowData last = null;
                if (ShowDataList.Count != 0)
                {
                    last = ShowDataList.Last();
                }

                if (a.Type == 0)
                {
                    if (last == null || last.Action != a.Action || last.Title != a.Title)
                    {
                        if (a.DateTime - lastmove > Consts.ActiveTimeSpan)
                        {
                            var fishdata = new Data.ShowData()
                            {
                                I           = Consts.Base64String2Icon(Consts.IconFishStr),
                                Start       = lastmove,
                                End         = a.DateTime,
                                Action      = Consts.CatchFishString,
                                IsCatchFish = true,
                                Title       = ""
                            };
                            ShowDataList.Add(fishdata);
                            last = ShowDataList.Last();
                        }
                        var SD = new Data.ShowData()
                        {
                            I      = a.Icon,
                            Start  = a.DateTime,
                            End    = a.DateTime,
                            Action = a.Action,
                            Title  = a.Title,
                        };
                        SD.IsCatchFish = CatchFishEvents.Any(str => { return(str == SD.ActionTitle); });
                        if (last != null)
                        {
                            last.End = SD.Start;
                        }
                        ShowDataList.Add(SD);
                        lastmove = a.DateTime;
                    }
                    else
                    {
                        last.End = a.DateTime;
                    }
                }
                else
                {
                    if ((a.DateTime - lastmove) > Consts.ActiveTimeSpan)
                    {
                        if (ShowDataList.Count == 0)
                        {
                            goto End;
                        }
                        var lastshowdata = new Data.ShowData(ShowDataList.Last());
                        var fishdata     = new Data.ShowData()
                        {
                            I           = Consts.Base64String2Icon(Consts.IconFishStr),
                            Start       = lastmove,
                            End         = a.DateTime,
                            Action      = Consts.CatchFishString,
                            IsCatchFish = true,
                            Title       = ""
                        };
                        ShowDataList.Last().End = lastmove;
                        ShowDataList.Add(fishdata);
                        lastshowdata.Start = lastshowdata.End = a.DateTime;
                        ShowDataList.Add(lastshowdata);
                    }
                    End :;
                    lastmove = a.DateTime;
                }
            }

            var tmplist = ShowDataList;

            ShowDataList = new List <Data.ShowData>();
            foreach (var i in tmplist)
            {
                if (ShowDataList.Count > 0 && i.Action == ShowDataList.Last().Action&& i.Title == ShowDataList.Last().Title)
                {
                    ShowDataList.Last().End = i.End;
                }
                else if (i.Ticks > Consts.MinimumCountTimeSpan.Ticks)
                {
                    ShowDataList.Add(i);
                }
                else if (ShowDataList.Count > 0)
                {
                    ShowDataList.Last().End = i.End;
                }
            }

            if (ShowDataList.Count == 0)
            {
                return(0);
            }

            double totalTime = (ShowDataList.Last().End - ShowDataList[0].Start).Ticks;

            foreach (var data in ShowDataList)
            {
                bool newdata = true;
                foreach (var old in SectorDataList)
                {
                    if (old.Action == data.Action && old.Title == data.Title)
                    {
                        newdata    = false;
                        old.Ticks += data.Ticks;
                        data.Color = old.Color;
                    }
                }
                if (newdata)
                {
                    data.Color = Consts.NextBrush;
                    var TSD = new Data.ShowData(data);
                    SectorDataList.Add(TSD);
                }
            }
            SectorDataList.Sort((Data.ShowData x, Data.ShowData y) => {
                return(y.Ticks.CompareTo(x.Ticks));
            });
            return(totalTime);
        }