/// <summary>
        /// Executes the CopyAllItems command.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="eventArgs">Event arguments</param>
        public void ExecuteCopyAllItemsCommand(object sender, ExecutedRoutedEventArgs eventArgs)
        {
            foreach (var item in List1)
            {
                List2.Add(item);
            }

            List1.Clear();
            OnPropertyChanged(() => List1);
            OnPropertyChanged(() => List2);
        }
Beispiel #2
0
        public async void LoadDafaultData()
        {
            try
            {
                ObservableCollection <Subscription> subscriptions1 = await objClean.LoadIndividual();

                ObservableCollection <Subscription> subscriptions2 = await objClean.LoadCorporate();

                List1 = subscriptions1;
                List2 = subscriptions2;
            }
            catch (Exception exception)
            {
                List1.Clear();
            }
        }
        public void Write_text1()
        {
            //skinButton_txt.Enabled = false;
            string       Date    = DateTime.Now.ToString("yyy-MM-dd");
            FileStream   acce    = new FileStream(location + "\\" + "加速度和螺旋仪数据" + Date + ".txt", FileMode.Append);
            StreamWriter sw_acce = new StreamWriter(acce);

            for (int i = 0; i < List1.Count; i++)
            {
                sw_acce.Write(List1[i]);
            }
            sw_acce.Write("\r\n");
            sw_acce.Flush();
            sw_acce.Close();
            List1.Clear();
            skinButton_txt.Enabled = true;
        }
        static string location = System.Environment.CurrentDirectory;//获取debug所在位置

        //保存数据
        private void skinButton_list_Click(object sender, EventArgs e)
        {
            if (skinButton_list.Text == "数据存储(关)")  //开始存储数据
            {
                skinButton_list.Text = "数据存储(开)";
                Save_flag            = true;
                if (List.Count > 0)
                {
                    List.Clear();
                }
                if (List1.Count > 0)
                {
                    List1.Clear();
                }
            }
            else
            {
                skinButton_list.Text = "数据存储(关)";
                Save_flag            = false;
            }
        }