Пример #1
0
        private void OnLoadableSourceChanged()
        {
            Items.Clear();
            current_index = 0;
            ListScrollViewer.ScrollToVerticalOffset(0);

            loadable_items = LoadableSourceFactory?.Invoke();

            TryRequestMoreItemFromLoadableSource();
        }
Пример #2
0
        private void OnLoadableSourceChanged()
        {
            CleanCurrentItems();
            current_index = 0;
            ListScrollViewer.ScrollToVerticalOffset(0);

            loadable_items = LoadableSourceFactory?.Invoke();
            Log.Debug($"generate new loadable_items({loadable_items?.GetHashCode()})");

            TryRequestMoreItemFromLoadableSource();
        }
Пример #3
0
        private void ListScrollViewer_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            e.Handled = true;

            if (drag_action_state == DragActionState.ReadyDrag)
            {
                drag_action_state = DragActionState.Dragging;
                Log.Debug($"{drag_action_state}", "ListScrollViewer_PreviewMouseMove");
            }

            if (DragActionState.Dragging == drag_action_state)
            {
                var y      = e.GetPosition(this).Y;
                var offset = prev_y - y;
                prev_y = y;

                ListScrollViewer.ScrollToVerticalOffset(ListScrollViewer.VerticalOffset + offset);
                Log.Debug($"Moving ... {drag_action_state}", "ListScrollViewer_PreviewMouseMove");
            }
        }
Пример #4
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);
        }