Пример #1
0
        private async void SongUpdateTimer_Tick(object sender, object e)
        {
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, HistoryUrl);

            using (HttpResponseMessage response = await HistoryClient.SendAsync(request))
            {
                string content = await response.Content.ReadAsStringAsync();

                content.Trim();
                string[] songs = content.Split("\n");
                Array.Reverse(songs);

                if (songs.Length > 1)
                {
                    CurrentSong = songs[1];
                }

                HistoryList.Clear();
                foreach (string song in songs)
                {
                    if (!string.IsNullOrEmpty(song))
                    {
                        HistoryList.Add(song);
                    }
                }
            }
        }
Пример #2
0
        private void clearSnapshots()
        {
            var historySettings = Properties.HistorySettings.Default;

            historySettings.HistoryList = "<History></History>";
            historySettings.Save();
            snapshots.Clear();
            bindSnapshots();
        }
Пример #3
0
 void Refresh()
 {
     HistoryList.Clear();
     foreach (var item in _codeStorageManager.Codes)
     {
         HistoryList.Add(new HistoryItem {
             Code = item.Code, Status = item.Status
         });
     }
 }
Пример #4
0
        private void Clear_Click(object sender, EventArgs e)
        {
            DialogResult Result = MessageBox.Show("Вы действительно хотите очистить историю счёта?", "Подтвердите действие", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Result == DialogResult.Yes)
            {
                StreamWriter sw = new StreamWriter(@"HistoryList.txt", false);
                sw.WriteLine("0");
                sw.Close();

                HistoryList.Clear();
            }
        }
Пример #5
0
        public HistoryListViewModel(IGeneratorService generator, IClipboardService clipboardService)
        {
            _subscriptions = new CompositeDisposable
            {
                generator.ContentCleared.ObserveOnDispatcher().Do(x => { HistoryList.Clear(); }).Subscribe(),
                generator.ContentCreated.ObserveOnDispatcher().Do(x =>
                {
                    var vm = new HistoryListItemViewModel(x, clipboardService);
                    HistoryList.Insert(0, vm);
                }).Subscribe()
            };

            ClearHistoryCommand = ReactiveCommand.Create(generator.ClearHistory);
        }
Пример #6
0
        public void RefreshHistory(string selectedPath)
        {
            if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
            {
                return;
            }
            HistoryList.Clear();

            HistorySelectedPath    = selectedPath;
            SelectedRepositoryPath = selectedPath.Replace(gitRepository.GetRepositoryDirectory(), "").Replace(@"\", "/");
            if (string.IsNullOrEmpty(SelectedRepositoryPath))
            {
                SelectedRepositoryPath = "/";
            }
            NotifyPropertyChanged("SelectedRepositoryPath");

            AddHistoryFrom(HistorySelectedPath, skip_count: 0);
        }
Пример #7
0
        private void BuildHistory()
        {
            HistoryList.Clear();
            HistoryBreakdown.Clear();

            var listOfTargets = new List <string>();
            var listOfTimes   = new List <string>();

            foreach (var history in _combatControl.CombatHistory)
            {
                listOfTargets.AddRange(history.Select(breakdown => breakdown.Target));

                listOfTimes.AddRange(history.Select(breakdown => breakdown.Time.ToString(CultureInfo.CurrentCulture)));

                var titleForHistory = $"{GetLast(listOfTimes)} {MostCommonString(listOfTargets)}";
                HistoryBreakdown.Insert(0, titleForHistory);
                HistoryList[titleForHistory] = new ObservableCollection <IDelegateBreakdown>(history.ToList());

                listOfTargets.Clear();
            }
        }
Пример #8
0
        public History_Screen()
        {
            InitializeComponent();

            float        account = 0;
            StreamReader sr      = null;

            try
            {
                sr      = new StreamReader(@"CurrentStateList.txt");
                account = float.Parse(sr.ReadLine());
                sr.Close();
            }
            catch
            {
                MessageBox.Show("Произошла ошибка при загрузке данных. Текущее состояние счёта будет очищено, приложение перезагружено.",
                                "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                StreamWriter sw = new StreamWriter(@"CurrentStateList.txt", false);
                sw.Write("");
                sw.Close();
                Application.Restart();
            }
            History_Record Transfer = new History_Record();

            Transfer.Write();

            Account.Text = Math.Round(account, 2).ToString() + " руб.";
            Today.Text   = DateTime.Today.ToShortDateString();

            try
            {
                sr = new StreamReader(@"HistoryList.txt");
            }
            catch
            {
                FileStream   fs = File.Create(@"HistoryList.txt");
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine("0");
                sw.Close();
                fs.Close();
                sr = new StreamReader(@"HistoryList.txt");
            }

            if (!int.TryParse(sr.ReadLine(), out int n))
            {
                return;
            }
            History_Record[] HistoryRecord = new History_Record[n];
            for (int i = 0; i < n; i++)
            {
                HistoryRecord[i] = new History_Record();
                if (!HistoryRecord[i].Read(sr))
                {
                    MessageBox.Show("Произошла ошибка при загрузке данных. История счёта будет очищена.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    sr.Close();
                    StreamWriter sw = new StreamWriter(@"HistoryList.txt", false);
                    sw.WriteLine("0");
                    sw.Close();

                    HistoryList.Clear();
                    n = 0;
                    return;
                }

                if (i != 0 && HistoryRecord[i - 1].GetDate != HistoryRecord[i].GetDate)
                {
                    HistoryList.Items.Add("  " + HistoryRecord[i].GetDate.ToShortDateString());
                    HistoryList.Items[HistoryList.Items.Count - 1].ForeColor = Color.White;
                    HistoryList.Items[HistoryList.Items.Count - 1].BackColor = Color.FromArgb(64, 64, 64);
                }
                if (i == 0)
                {
                    HistoryList.Items.Add("  " + HistoryRecord[i].GetDate.ToShortDateString());
                    HistoryList.Items[HistoryList.Items.Count - 1].ForeColor = Color.White;
                    HistoryList.Items[HistoryList.Items.Count - 1].BackColor = Color.FromArgb(64, 64, 64);
                }

                HistoryList.Items.Add("  " + HistoryRecord[i].GetCategory);
                HistoryList.Items[HistoryList.Items.Count - 1].Font = new Font("Century Gothic", 10, FontStyle.Bold);

                string amount = HistoryRecord[i].GetIncrease ? "+" : "-";
                amount += HistoryRecord[i].GetAmount + " руб.";
                HistoryList.Items.Add("  " + amount);
                HistoryList.Items[HistoryList.Items.Count - 1].Font      = new Font("Century Gothic", 15, FontStyle.Bold);
                HistoryList.Items[HistoryList.Items.Count - 1].ForeColor = HistoryRecord[i].GetIncrease ? Color.FromArgb(0, 142, 63) : Color.FromArgb(144, 12, 10); //зеленый : красный

                HistoryList.Items.Add("  " + HistoryRecord[i].GetComment);
                HistoryList.Items[HistoryList.Items.Count - 1].Font = new Font("Century Gothic", 10);
            }
            sr.Close();
        }
Пример #9
0
        private void ExecuteLoadHistoryCommand(UDOSight claim)
        {
            HistoryList.Clear();
            //изменения за сегдня
            var updatelist = _visingCore.GetUpdateList(claim);

            foreach (var item in updatelist)
            {
                var updatelistdetail = _visingCore.GetUpdateListDetail(item);
                foreach (var itemdetail in updatelistdetail)
                {
                    var historicalAction = new RevisionHistoryUdoSight {
                        Date = item.MODIFDATE, Who = item.AUTHID
                    };
                    historicalAction.Action = new GroupNameConverter().Convert("Claim." + itemdetail.COLUMNNAME, null, null, null).ToString();
                    if (itemdetail.COLUMNNAME == "STATE")
                    {
                        if (itemdetail.NUMVALUE != null)
                        {
                            historicalAction.Value = new ValueToStateConverter().Convert(itemdetail.NUMVALUE, null, null, null).ToString();
                            if (itemdetail.UPDNUMVALUE != null)
                            {
                                historicalAction.OldValue = new ValueToStateConverter().Convert(itemdetail.UPDNUMVALUE, null, null, null).ToString();
                            }
                        }
                    }
                    else
                    if (itemdetail.STRVALUE != null)
                    {
                        historicalAction.Value    = itemdetail.STRVALUE;
                        historicalAction.OldValue = itemdetail.UPDSTRVALUE;
                    }
                    if (historicalAction.OldValue != historicalAction.Value)
                    {
                        HistoryList.Add(historicalAction);
                    }
                }
            }
            //изменениния из архива
            var updatelistarc = _visingCore.GetUpdateListArc(claim);

            foreach (var item in updatelistarc)
            {
                var updatelistdetail = _visingCore.GetUpdateListDetailArc(item);
                foreach (var itemdetail in updatelistdetail)
                {
                    var historicalAction = new RevisionHistoryUdoSight {
                        Date = item.MODIFDATE, Who = item.AUTHID
                    };

                    historicalAction.Action = new GroupNameConverter().Convert(itemdetail.COLUMNNAME, null, null, null).ToString();
                    if (itemdetail.NUMVALUE != null)
                    {
                        historicalAction.Value = new ValueToStateConverter().Convert(itemdetail.NUMVALUE, null, null, null).ToString();
                        if (itemdetail.UPDNUMVALUE != null)
                        {
                            historicalAction.OldValue = new ValueToStateConverter().Convert(itemdetail.UPDNUMVALUE, null, null, null).ToString();
                        }
                    }
                    else
                    if (itemdetail.STRVALUE != null)
                    {
                        historicalAction.Value    = itemdetail.STRVALUE;
                        historicalAction.OldValue = itemdetail.UPDSTRVALUE;
                    }
                    if (historicalAction.OldValue != historicalAction.Value)
                    {
                        HistoryList.Add(historicalAction);
                    }
                }
            }
            HistoryList = new ObservableCollection <RevisionHistoryUdoSight>(HistoryList.OrderByDescending(x => x.Date));
        }
Пример #10
0
 public void Clear()
 {
     HistoryList.Clear();
     HistoryStack.Clear();
     RedoStack.Clear();
 }
Пример #11
0
 public void ClearHistory()
 {
     LastAccessDate = DateTime.Now;
     HistoryList.Clear();
 }