示例#1
0
        /// <summary>
        /// Button click that initiates a search for diffrent locations.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            ListBoxItems.Clear();
            XmlManager.LocationSheetList locationSheetList = new XmlManager.LocationSheetList();

            //Make sure to not block UI
            await Task.Run(() =>
            {
                try
                {
                    locationSheetList = WebServiceAPIContext.ReceiveLocationList(_SearchLocation, _ConnectionString);
                }
                catch (Exception ex)
                {
                    ShowErrorMessageBox(ex.Message);
                }
                if (locationSheetList.Error && locationSheetList.ExMsg != String.Empty)
                {
                    ShowErrorMessageBox(locationSheetList.ExMsg);
                }
            });

            if (locationSheetList.LocationSheets != null)
            {
                foreach (var x in locationSheetList.LocationSheets)
                {
                    Encoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(x.Name));

                    ListBoxItems.Add(x);
                }
            }
        }
        /// <summary>
        /// 获取需修改数据
        /// </summary>
        /// <param name="element"></param>
        /// <param name="buttonContent"></param>
        private void FetchEditData(ListBox element, string buttonContent)
        {
            try
            {
                if (ButtonContent.Equals("编辑"))
                {
                    ButtonContent = "完成";
                    ListBoxItems.Clear();

                    foreach (AlarmClockModel model in MainAlarmClockManager.Instance.AlarmClocks)
                    {
                        AddNewEditReminder(element, model);
                    }
                }
                else if (ButtonContent.Equals("完成"))
                {
                    ButtonContent = "编辑";
                    ListBoxItems.Clear();

                    foreach (AlarmClockModel model in MainAlarmClockManager.Instance.AlarmClocks)
                    {
                        AddNewReminder(element, model);
                    }
                }
            }
            catch (Exception e)
            {
                LogWriter.Instance.Error(e);
            }
        }
示例#3
0
        private void InitCommand(Random random)
        {
            ListBoxItems.Clear();

            var          json       = File.ReadAllText(@"Resources\json\block.json");
            List <Block> blockLists = JsonConvert.DeserializeObject <List <Block> >(json);

            foreach (Block block in blockLists)
            {
                var contentItems = new ContentItems()
                {
                    MetorInfos = new ObservableCollection <MetorInfo>()
                };
                List <MetorInfo> data = block.data;
                foreach (MetorInfo metorInfo in data)
                {
                    //new TransitionEffect().LetterNCircle();
                    var metor = new MetorInfo
                    {
                        Name   = metorInfo.Name,
                        Color  = metorInfo.Color,
                        Width  = metorInfo.Width,
                        Height = metorInfo.Height,
                        View   = metorInfo.View,
                        Effect = new TransitionEffect()
                        {
                            Kind     = kinds[random.Next(0, kinds.Count)],
                            Duration = new TimeSpan(0, 0, 0, 0, 10)
                        }
                    };
                    contentItems.MetorInfos.Add(metor);
                }
                ListBoxItems.Add(contentItems);
            }

            //for (int i = 0; i < 2; i++)
            //{
            //    var contentItems = new ContentItems() { MetorInfos = new ObservableCollection<MetorInfo>() };
            //    for (int j = 0; j < 5; j++)
            //    {
            //        //var metorInfos = new ObservableCollection<MetorInfo>();
            //        var metor = new MetorInfo
            //        {
            //            Name = "应用" + j,
            //            Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(colors[random.Next(0, colors.Count)])),
            //            Width = random.Next(0, 8) < 4 ? 314 : 150,
            //            Height = 150,
            //            Effect = new TransitionEffect()
            //            {
            //                Kind = kinds[random.Next(0, kinds.Count)],
            //                Duration = new TimeSpan(0, 0, 0, 0, 900)
            //            }
            //        };
            //        contentItems.MetorInfos.Add(metor);
            //    }
            //    ListBoxItems.Add(contentItems);
            //}
        }
示例#4
0
 public void Clear()
 {
     lock (_resultsUpdateLock)
     {
         _results.Clear();
         lbResults.Margin = new Thickness {
             Top = 0
         };
     }
 }
 /// <summary>
 /// 获取初始数据
 /// </summary>
 /// <param name="element"></param>
 private void FetchData(ListBox element)
 {
     try
     {
         ListBoxItems.Clear();
         foreach (var item in MainAlarmClockManager.Instance.AlarmClocks)
         {
             AddNewReminder(element, item);
         }
     }
     catch (Exception e)
     {
         LogWriter.Instance.Error(e);
     }
 }
 /// <summary>
 /// 返回闹钟主页面回调
 /// </summary>
 /// <param name="target"></param>
 private void BackToMainView(string target)
 {
     try
     {
         ListBoxItems.Clear();
         foreach (AlarmClockModel model in MainAlarmClockManager.Instance.AlarmClocks)
         {
             AddNewReminder(_mainListBox, model);
         }
         ButtonContent     = "编辑";
         _mainBorder.Child = _lastUIElement;
     }
     catch (Exception e)
     {
         LogWriter.Instance.Error(e);
     }
 }
示例#7
0
 /// <summary>
 /// 返回提醒主页面回调
 /// </summary>
 /// <param name="target"></param>
 private void BackToMainView(string target)
 {
     try
     {
         ListBoxItems.Clear();
         if (_isReminderRemote || TitleContent.Equals("远程提醒"))
         {
             foreach (ReminderModel model in ReminderManager.Instance.Reminders.ToArray())
             {
                 if (!string.IsNullOrEmpty(model.Contact))
                 {
                     AddNewReminder(_mainListBox, model);
                 }
             }
         }
         else
         {
             foreach (ReminderModel model in ReminderManager.Instance.Reminders.ToArray())
             {
                 if (string.IsNullOrEmpty(model.Contact))
                 {
                     AddNewReminder(_mainListBox, model);
                 }
             }
         }
         //ButtonContent = "编辑";
         //if (target.Equals("Cancel"))
         //{
         //    _mainBorder.Child = _lastUIElement;
         //}
         if (!string.IsNullOrEmpty(target))
         {
             _mainBorder.Child = _lastUIElement;
         }
     }
     catch (Exception e)
     {
         LogWriter.Instance.Error(e);
     }
 }
 private void button_River_Click(object sender, RoutedEventArgs e)
 {
     ListBoxItems.Clear();
     Rivers.ForEach(i => ListBoxItems.Add(i));
 }