Esempio n. 1
0
        public void DoubleClickItemGoToTop()
        {
            if (!InitComplete)
            {
                MessageBox.Show("天气信息正在排队初始化中,现在不能改变城市顺序,请稍后再试!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            InitComplete = false;

            try
            {
                if (DataGridSelectItemCityInfo != null)
                {
                    SavedCityInfoList.Move(SavedCityInfoList.IndexOf(DataGridSelectItemCityInfo), 0);

                    Task.Factory.StartNew(() =>
                    {
                        XmlHelper.WriteToXml(SavedCityInfoList.ToList());
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("已保存城市顺序调整失败!\n" + ex.Message, "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            InitComplete = true;
        }
Esempio n. 2
0
        public void ChangeSavedCityListByDrop(CityInfo sourceItem, CityInfo targetItem)
        {
            if (!InitComplete)
            {
                MessageBox.Show("天气信息正在排队初始化中,现在不能改变城市顺序,请稍后再试!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            InitComplete = false;

            try
            {
                SavedCityInfoList.Move(SavedCityInfoList.IndexOf(sourceItem), SavedCityInfoList.IndexOf(targetItem));

                Task.Factory.StartNew(() =>
                {
                    XmlHelper.WriteToXml(SavedCityInfoList.ToList());
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show("已保存城市顺序调整失败!\n" + ex.Message, "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            InitComplete = true;
        }