private void FillListBoxWithUsnEntries(NtfsUsnJournal.UsnJournalReturnCode rtnCode, List <Win32Api.UsnEntry> usnEntries, Win32Api.USN_JOURNAL_DATA_V0 newUsnState)
        {
            FunctionElapsedTime.Content = string.Format(CultureInfo.InvariantCulture, "'View Changes'->{0} duration: {1} (ms)", "GetUsnJournalEntries", NtfsUsnJournal.ElapsedTime.TotalMilliseconds);

            if (rtnCode == NtfsUsnJournal.UsnJournalReturnCode.USN_JOURNAL_SUCCESS)
            {
                if (usnEntries.Count > 0)
                {
                    _entryDetail          = UsnEntryDetail.EntryDetail.UsnEntry;
                    resultsLb.ItemsSource = usnEntries;

                    var updateUsnStateDlg = new UpdateUsnStateDialog(this)
                    {
                        Owner = this
                    };

                    var bRtn = updateUsnStateDlg.ShowDialog();
                    if (bRtn != null && bRtn.Value)
                    {
                        _usnCurrentJournalState = newUsnState;
                    }
                }

                else
                {
                    var lbItem = new ListBoxItem
                    {
                        Content    = "\'View Changes\'-> No Journal entries found",
                        Foreground = Brushes.Red
                    };

                    resultsLb.Items.Add(lbItem);
                }
            }

            else
            {
                var lbItem = new ListBoxItem
                {
                    Content    = string.Format(CultureInfo.InvariantCulture, "'View Changes'->{0} returned error code: {1}", "GetUsnJournalEntries", rtnCode),
                    Foreground = Brushes.Red
                };

                resultsLb.Items.Add(lbItem);
            }

            Cursor = Cursors.Arrow;
        }
Пример #2
0
        private void FillListBoxWithUsnEntries(NtfsUsnJournal.UsnJournalReturnCode rtnCode, List <Win32Api.UsnEntry> usnEntries, Win32Api.USN_JOURNAL_DATA newUsnState)
        {
            FunctionElapsedTime.Content = string.Format("'View Changes'->{0} elapsed time {1}(ms)",
                                                        "GetUsnJournalEntries()", NtfsUsnJournal.ElapsedTime.Milliseconds.ToString());

            if (rtnCode == NtfsUsnJournal.UsnJournalReturnCode.USN_JOURNAL_SUCCESS)
            {
                if (usnEntries.Count > 0)
                {
                    _entryDetail          = UsnEntryDetail.EntryDetail.UsnEntry;
                    resultsLb.ItemsSource = usnEntries;

                    UpdateUsnStateDialog updateUsnStateDlg = new UpdateUsnStateDialog(this);
                    updateUsnStateDlg.Owner = this;
                    bool?bRtn = updateUsnStateDlg.ShowDialog();
                    if (bRtn != null && bRtn.Value)
                    {
                        _usnCurrentJournalState = newUsnState;
                    }
                }
                else
                {
                    ListBoxItem lbItem = new ListBoxItem();
                    lbItem.Content    = string.Format("'View Changes'-> No Journal entries found");
                    lbItem.Foreground = Brushes.Red;
                    resultsLb.Items.Add(lbItem);
                }
            }
            else
            {
                ListBoxItem lbItem = new ListBoxItem();
                lbItem.Content    = string.Format("'View Changes'->{0} returned error code: {1}", "GetUsnJournalEntries()", rtnCode.ToString());
                lbItem.Foreground = Brushes.Red;
                resultsLb.Items.Add(lbItem);
            }
            Cursor = Cursors.Arrow;
        }