Beispiel #1
0
        private void RefreshButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CheckAndFixErrors();
                if (SessionCtl.DataValidationFaulted)
                {
                    _vm.Changes = null;
                    return;
                }
                _vm.RefreshActiveSession();

                var changes = new ChangesViewModel(_vm.ActiveSession.GetPatches());
                _vm.Changes = changes;
                foreach (var p in changes)
                {
                    p.CommitChanged += (s2, e2) => UpdateIncludeAllBox();
                }
                UpdateIncludeAllBox();
            }
            finally
            {
                ApplyButton.IsEnabled = _vm.Changes?.Count > 0;
            }
        }
        private void RefreshButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(Session.FolderPath) || string.IsNullOrEmpty(Session.FilePath))
            {
                return;
            }
            var folderModules = Lib.GetFolderModules(Session.FolderPath);

            _evf?.Dispose();
            _evf = new VbaFolder();
            _evf.Read(Session.FilePath, folderModules.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Item1));
            var changes    = Lib.GetModulePatches(Session, _evf.FolderPath, folderModules, _evf.ModuleTexts.ToList()).ToList();
            var projChange = Lib.GetProjectPatch(Session, _evf.FolderPath);

            if (projChange != null)
            {
                changes.Add(projChange);
            }
            var cvm = new ChangesViewModel(changes);

            ChangesGrid.DataContext = cvm;
            foreach (var ch in cvm)
            {
                ch.CommitChanged += (s2, e2) => UpdateIncludeAllBox();
            }
            UpdateIncludeAllBox();
        }