public MainViewModel() { var events = new EventAggregator(); var config = new Configuration(events: events).WithCss().WithDefaultLoader(m => { m.IsNavigationEnabled = true; m.IsResourceLoadingEnabled = true; }); context = BrowsingContext.New(config); profiler = new ProfilerViewModel(events); errors = new ErrorsViewModel(events); dom = new DOMViewModel(); query = new QueryViewModel(); repl = new ReplViewModel(); settings = new SettingsViewModel(); statistics = new StatisticsViewModel(); tree = new TreeViewModel(); sheets = new SheetViewModel(); cts = new CancellationTokenSource(); views = new ITabViewModel[] { dom, query, repl, statistics, tree, sheets }; logs = new IEventViewModel[] { profiler, errors }; }
public SyncErrorsPanel(ErrorsViewModel viewModel) { MouseButtonEventHandler handler = null; this.InitializeComponent(); this.ViewModel = viewModel; base.DataContextChanged += new DependencyPropertyChangedEventHandler(this.SyncErrorsPanel_DataContextChanged); if (handler == null) { handler = delegate { base.DragMove(); }; } base.MouseDown += handler; }
public IActionResult Errors() { var exceptions = _appDbContext.Exceptions.OrderByDescending(x => x.SiteExceptionId); //var bookingRecords = _appDbContext.BookingRecords.Where(x => x.Created > _calendar.LocalTime().AddDays(-7)).Take(100); SessionDetailsViewModel sessionDetails = _cart.SessionsDetails(); ErrorsViewModel result = new ErrorsViewModel() { Exceptions = exceptions, SessionDetails = sessionDetails, BookingRecords = new List <BookingRecord>() }; return(View(result)); }
public IActionResult Errors(ErrorsViewModel model) { switch (model.MigrationErrors) { case MigrationErrors.FixErrors: return(RedirectToAction("Index", "PublishCourses", new { publishMode = PublishMode.Migration })); case MigrationErrors.DeleteCourses: return(RedirectToAction("Index", "HelpDesk")); case MigrationErrors.StartAgain: return(RedirectToAction("Index", "BulkUpload")); default: return(RedirectToAction("Errors")); } }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, ConsoleViewModel consoleViewModel, ErrorsViewModel errorsViewModel, WatchesViewModel watchesViewModel, IFileSystem fileSystem, ScriptDialogStrategy scriptDialogStrategy, IPaths paths, IParser parser, IPortable portable ) : base(resultFactory) { this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; this.fileSystem = fileSystem; this.scriptDialogStrategy = scriptDialogStrategy; this.paths = paths; this.parser = parser; Scripts = new BindableCollection <ScriptEditorViewModel>(); Tools = new BindableCollection <PanelViewModel> { consoleViewModel, errorsViewModel, watchesViewModel }; Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); Menu.HelpFiles = settingsManager.ListPluginSettingsWithHelpFile().Select(ps => new PluginHelpFileViewModel(ps)).ToList(); Menu.Views = Tools; DisplayName = string.Format("FreePIE - Programmable Input Emulator{0}", portable.IsPortable ? " (Portable mode)" : null); }
public OpenErrorsScreen(DatabaseExplorer database, ErrorsViewModel errors) { this.database = database; this.errors = errors; }
public ErrorsView() { InitializeComponent(); DataContext = new ErrorsViewModel(); }
public ErrorsView(ErrorsViewModel errorsVM) : base(errorsVM) { InitializeComponent(); }
public override IDock CreateLayout() { // - В будущем текущий язык среды будет подгружаться с файла Localizer.GetInstance().LoadLanguage("en-EN"); var Dict = Semantic.Scripts.Localizer.GetInstance().Strings; // - Подготовка панелей для объединения в layout // - Страница "Добро пожаловать" var welcome = new WelcomeViewModel { Id = "Welcome", Title = Dict["WelcomePage"] }; // - Панель "Проект" var project = new ProjectViewModel { Id = "Project", Title = Dict["Project"] }; // - Панель "Задачник" var taskbook = new TaskbookViewModel { Id = "Taskbook", Title = Dict["Taskbook"] }; // - Панель "Документация" var help = new HelpViewModel { Id = "Help", Title = Dict["Help"] }; // - Панель "Ошибки" var errors = new ErrorsViewModel { Id = "Errors", Title = Dict["ErrorsList"] }; // - Панель "Журнал команд" var commandLog = new CommandLogViewModel { Id = "CommandLog", Title = Dict["CommandLog"] }; // - Панель "Консоль" var console = new ConsoleViewModel { Id = "Console", Title = Dict["Console"] }; // - Делим layout на две части: нижнюю и верхнюю var mainLayout = new ProportionalDock { Id = "MainLayout", Title = "MainLayout", Proportion = double.NaN, Orientation = Orientation.Vertical, ActiveDockable = null, VisibleDockables = CreateList <IDockable> ( // - Верхняя часть содержит проект, задачник, докум-ю и редактор кода new ProportionalDock { Id = "UpperPart", Title = "UpperPart", Proportion = double.NaN, Orientation = Orientation.Horizontal, ActiveDockable = null, VisibleDockables = CreateList <IDockable> ( new ToolDock { Id = "UpperTool1", Title = "UpperTool1", Proportion = double.NaN, ActiveDockable = project, VisibleDockables = CreateList <IDockable> ( project, // - Вкладка со структурой проекта taskbook, // - Вкладка с задачами help // - Вкладка с документацией ) }, new SplitterDock { Id = "UpperSplitter", Title = "UpperSplitter" }, new DocumentDock { Id = "DocumentPane", Title = "DocumentPane", Proportion = double.NaN, ActiveDockable = welcome, VisibleDockables = CreateList <IDockable>(welcome) } ) }, // - Разделитель частей new SplitterDock { Id = "LayoutSplitter", Title = "LayoutSplitter" }, // - Нижняя часть содержит ошибки, журнал команд и консоль new ProportionalDock { Id = "LowerPart", Title = "LowerPart", Proportion = double.NaN, Orientation = Orientation.Horizontal, ActiveDockable = null, VisibleDockables = CreateList <IDockable> ( new ToolDock { Id = "LowerTool1", Title = "LowerTool1", Proportion = double.NaN, ActiveDockable = errors, VisibleDockables = CreateList <IDockable> ( errors, commandLog ) }, new SplitterDock { Id = "LowerSplitter", Title = "LowerSplitter" }, new ToolDock { Id = "LowerTool2", Title = "LowerTool2", Proportion = double.NaN, ActiveDockable = console, VisibleDockables = CreateList <IDockable>(console) } ) } ) }; var mainView = new MainViewModel { Id = "MainView", Title = "MainView", ActiveDockable = mainLayout, VisibleDockables = CreateList <IDockable>(mainLayout) }; var root = CreateRootDock(); root.Id = "Root"; root.Title = "Root"; root.ActiveDockable = mainView; root.DefaultDockable = mainView; root.VisibleDockables = CreateList <IDockable>(mainView); return(root); }
public ErrorWindow(ErrorsViewModel viewModel) { InitializeComponent(); DataContext = viewModel; }
public async Task <IActionResult> Edit(ChangeRolesViewModel model) { var user = await _userManager.FindByIdAsync(model.UserId); IList <string> errorMessages = new List <string>(); if (!IsValid(model, out errorMessages)) { var viewModel = new ErrorsViewModel { Title = "Roles validation error", Text = "Validation errors occurred while editing user roles", Errors = errorMessages, GoBackUrl = Url.Action("Edit", "Roles", new { userId = model.UserId }) }; return(View("Errors", viewModel)); } if (user == null) { return(NotFound()); } var userRoles = await _userManager.GetRolesAsync(user); bool userWasModerator = userRoles.Contains("Moderator"); if (userWasModerator && model.UserRoles.Contains("Moderator")) // only sections were changed { var removedReferences = _dbContext.SectionModerators .Where(sm => !model.ModeratedByUserSections.Contains(sm.SectionId) && model.UserId.Equals(sm.ModeratorId)).ToList(); _dbContext.SectionModerators.RemoveRange(removedReferences); var userModeratableSections = _dbContext.SectionModerators.Where(sm => sm.ModeratorId.Equals(model.UserId)).Select(sm => sm.SectionId).ToList(); foreach (var sectionId in model.ModeratedByUserSections) { if (!userModeratableSections.Contains(sectionId)) { _dbContext.SectionModerators.Add(new SectionModerator { ModeratorId = model.UserId, SectionId = sectionId }); } } } else if (!userWasModerator && model.UserRoles.Contains("Moderator")) // user assigned as moderator { foreach (var section in _dbContext.Sections) { if (model.ModeratedByUserSections.Contains(section.Id)) { var sectionModerator = new SectionModerator { ModeratorId = user.Id, SectionId = section.Id, }; _dbContext.SectionModerators.Add(sectionModerator); } } } else if (userWasModerator && !model.UserRoles.Contains("Moderator")) // user removed from moderators { var moderatableByUserSections = _dbContext.SectionModerators.Where(sm => sm.ModeratorId.Equals(user.Id)); _dbContext.SectionModerators.RemoveRange(moderatableByUserSections); } _dbContext.SaveChanges(); var addedRoles = model.UserRoles.Except(userRoles); var removedRoles = userRoles.Except(model.UserRoles); await _userManager.AddToRolesAsync(user, addedRoles); await _userManager.RemoveFromRolesAsync(user, removedRoles); return(View("Success")); }