public void PropertiesTest() { var vm = new LogViewModel(); var topManager = Mock.Create<IShell>(); vm.WindowManager = new Lazy<IShell>(() => topManager); TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true); }
public GameViewModel(GameModel gameModel) { this.gameModel = gameModel; this.log = new LogViewModel(this.gameModel.TextLog); this.gameModel.ModelUpdated += new EventHandler(gameModel_ModelUpdated); this.gameModel.RefreshUI += new EventHandler(gameModel_RefreshUI); // this.gameModel.ItemBought += new EventHandler<Dominion.GameModel.ItemBoughtEventArgs>(gameModel_ItemBought); this.gameModel.GameInitialized += new EventHandler(gameModel_GameInitialized); this.gameModel.PropertyChanged += new PropertyChangedEventHandler(gameModel_PropertyChanged); }
public LogWindow(LogViewModel viewModel) { InitializeComponent(); _viewModel = viewModel; DataContext = _viewModel; datePicker.Loaded += delegate { var textBox1 = (TextBox) datePicker.Template.FindName("PART_TextBox", datePicker); textBox1.Background = datePicker.Background; textBox1.BorderThickness = new Thickness(0, 0, 0, 0); textBox1.BorderBrush = Brushes.Transparent; }; _viewModel.RefreshLog(); }
public IActionResult LoginLogs() { var models = new List <LogViewModel>(); var logs = context.DBLogs.Where(log => log.LogType == "Login").ToList(); foreach (var log in logs) { var model = new LogViewModel { Operatingtime = log.Operatingtime, UserName = log.UserName, Identity = log.Identity, Requesturl = log.Requesturl, Method = log.Method, Message = log.Message, Exception = log.Exception }; models.Add(model); } return(View(models)); }
public void Export() { var csvDelimiter = AdvEnvironment.CSVDelimiter; var logViewModel = new LogViewModel(eventLog); var expectedString = string.Format("Date{0} Action{0} AccessType{0} Path{0} ProcessPath\r\n", csvDelimiter); foreach (var logEntryData in logViewModel.Data) { expectedString += string.Format("{0}{5} {1}{5} {2}{5} {3}{5} {4}\r\n", logEntryData.Date, logEntryData.IsAllowed ? "Allow" : "Block", logEntryData.AccessType, logEntryData.Path, logEntryData.ProcessPath, csvDelimiter); } var exportedString = logViewModel.Export(); Assert.AreEqual(expectedString, exportedString); }
public async Task <ActionResult <Log> > PostLog(LogViewModel logViewModel) { try { Log log = new Log { IPAddress = logViewModel.IPAddress, LogDate = DateTime.Parse(logViewModel.LogDate), LogMessage = logViewModel.LogMessage }; _context.Logs.Add(log); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetLogById), new { id = log.Id }, log)); } catch (Exception) { return(BadRequest("Log file is in invalid format.")); } }
public ActionResult LogView(LogViewModel model) { IQueryable <SignInLogModel> query = dbContext.SignInLogModels; if (model.dateFrom.HasValue) { query = query.Where(sil => sil.ProcessingDate >= model.dateFrom.Value); } if (model.dateTo.HasValue) { DateTime toExtend = model.dateTo.Value.AddDays(1); query = query.Where(sil => sil.ProcessingDate <= toExtend); } if (!string.IsNullOrEmpty(model.SigninCode)) { query = query.Where(sil => sil.UserCode == model.SigninCode); } model.logs = query.OrderByDescending(sil => sil.ProcessingDate).ToList(); return(View(model)); }
public IActionResult All(string userName, int page = 1) { LogViewModel model = new LogViewModel(); if (string.IsNullOrWhiteSpace(userName)) { model.Items = this.logService.Get(page, TakeCount); } else { model.Items = this.logService.GetByUserName(userName, page, TakeCount); } int allLogs = this.logService.GetCountOfAll(userName); model.Allpages = (int)Math.Ceiling(Convert.ToDouble(allLogs) / Convert.ToDouble(TakeCount)); model.CurrentPage = page; model.Username = userName; return(this.View(model)); }
private void ShouldRecycleBattleStateCheck(IGameContext context) { try { var chatEntries = context.API.Chat.ChatEntries.ToList(); var invalidTargetPattern = new Regex("Unable to see"); List <EliteMMO.API.EliteAPI.ChatEntry> matches = chatEntries .Where(x => invalidTargetPattern.IsMatch(x.Text)).ToList(); foreach (EliteMMO.API.EliteAPI.ChatEntry m in matches.Where(x => x.Timestamp.ToString() == DateTime.Now.ToString())) { context.API.Windower.SendString(Constants.AttackOff); LogViewModel.Write("Recycled battle stance to properly engage the target."); } } catch (System.InvalidOperationException e) { LogViewModel.Write("Chat log updated while trying to recycle, could not recycle battle stance. Exception message: " + e.Message); } }
public void ReportViewModel_LogViewModel_Set_Default_Should_Pass() { //Arrange var myTest = new ReportViewModel(); var myLog = new LogViewModel(); var myList = new List <LogModel>(); myList.Add(new LogModel { PhoneID = "Phone" }); myLog.LogList = myList; var result = myLog.LogList; //Act myTest.LogViewModel = myLog; //Assert Assert.AreEqual(myTest.LogViewModel, myLog); }
protected override void OnException(ExceptionContext filterContext) { filterContext.ExceptionHandled = true; var logViewModel = new LogViewModel { FullMessage = filterContext.Exception.Message, ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(), Method = filterContext.Exception.TargetSite.Name, ExceptionStackTrace = filterContext.Exception.StackTrace, LogLevelId = (int)LogLevel.Error, LogTime = DateTime.UtcNow, ApplicationObject = filterContext.Exception.Source, HelpLink = filterContext.Exception.HelpLink, InnerException = filterContext.Exception.InnerException?.Message }; var logDto = _mapper.Map <Log>(logViewModel); var result = _logService.Create(logDto); filterContext.Result = RedirectToAction("Index", new RouteValueDictionary( new { controller = "ErrorHandler", action = "Index", exceptionId = result.Id })); }
public void ReportViewModel_LogViewModel_Set_Default_Should_Pass() { //Arrange // Creating a new LogModel and adding it to the MyTest, with a PhoneID of "phone" var myTest = new LogViewModel(); var myList = new List <LogModel>(); myList.Add(new LogModel { PhoneID = "Phone" }); var testReportViewModel = new ReportViewModel(); //Act testReportViewModel.LogViewModel = myTest; var result = testReportViewModel.LogViewModel.LogList; //Assert Assert.AreEqual("Phone", result[0].PhoneID); }
public void Refresh() { var logViewModel = new LogViewModel(eventLog); // This entry will not be displayed, until user not clicked "Refresh". var bytes = LogEntryData.Serialize(new LogEntryData(DateTime.Now.ToShortTimeString(), false, AccessType.FILESYSTEM, "hello", "hello2")); EventLog.WriteEntry("APTester", "Hello world!", EventLogEntryType.Information, 0, 0, bytes); // Emulate click on "Refresh" button. logViewModel.Refresh(); // Assert // Check the equality of logView.Data and eventLog.Entries. for (var i = 0; i < eventLog.Entries.Count; i++) { Assert.IsTrue(PropertyComparer.AreEqual(LogEntryData.Deserialize(eventLog.Entries[i].Data), logViewModel.Data[i])); } }
private void EnviaEmailConfirmacao(ApplicationUser user) { var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id }, protocol: Request.Url.Scheme); _enviarEmail = new EnviaEmail(); var corpo = "Por favor confirme sua conta clicando neste link: <a href=" + '\u0022' + callbackUrl + '\u0022' + ">Clique aqui</a>"; var assunto = "Confirme seu email"; var send = _enviarEmail.EnviaEmailConfirmacao(user.Email, corpo, assunto); if (!send.Key) { var logVm = new LogViewModel(); logVm.Mensagem = send.Value; logVm.Controller = "Prestador"; logVm.View = "EnviaEmailConfirmacao"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); } }
public void LogFullManually(string action, string targetName, int?targetId = null, int?userId = null, string controller = "", string method = "", string fullname = "", string usercode = "", string newValue = "", string oldValue = "") { LogViewModel model = new LogViewModel { TargetId = targetId, UserId = userId, LogDate = DateTime.Now, TargetName = targetName, Action = action, Controller = controller, OldValue = oldValue, NewValue = newValue, Method = method, Fullname = fullname, Status = (int)Enum.StatusEnum.Checked, UserCode = usercode }; Log(model); }
public async Task <IActionResult> Log() { DirectoryInfo di = new DirectoryInfo(@".\logs\"); var lista = new List <LogViewModel>(); if (di.Exists) { foreach (var file in di.GetFiles()) { var vm = new LogViewModel() { Nombre = file.Name, Url = file.FullName, Fecha = file.CreationTime }; lista.Add(vm); } } //var logs = return(View(lista)); }
public ActionResult Login(LogViewModel lg) { if (ModelState.IsValid) { using (BitBookContext aBitBookContext = new BitBookContext()) { var log = aBitBookContext.Users.Where(a => a.Email.Equals(lg.Email) && a.Password.Equals(lg.Password)).FirstOrDefault(); if (log != null) { Session["email"] = log.Email; return(RedirectToAction("UserHome", "UserRegistration")); } else { Response.Write("<script> alert('Invalid Password')</script>"); } } } return(View()); }
public void OnAuthorization(AuthorizationFilterContext context) { string currentUser = context.HttpContext.Session.GetString("Username"); if (currentUser != null) { LogViewModel model = JsonConvert.DeserializeObject <LogViewModel>(currentUser); string Password = userService.GetById(model.CurrentUserId.ToString()).PassWord; if (Password == model.CurrentMD5Password) { return; } else { } } else { context.Result = new RedirectResult("/LogOn/Log"); } }
public ActionResult Log(int moduleId, int featureId, DateTime from = default(DateTime), DateTime to = default(DateTime), int granularity = 100) { var module = mc.GetModule(moduleId); if (from == default(DateTime)) { from = DateTime.UtcNow.AddDays(-1); } if (to == default(DateTime)) { to = DateTime.UtcNow; } var vm = new LogViewModel() { Module = module, Feature = module.Features.Single(x => x.Id == featureId), Values = module.GetLogValuesForRange(featureId, from, to, granularity) }; return(View(vm)); }
public async Task <ActionResult> ResetPassword(ResetPasswordViewModel model) { try { if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.FindByNameAsync(model.Email); if (user == null) { // Não revelar se o usuario nao existe ou nao esta confirmado return(RedirectToAction("Login", "Account")); } user.PasswordHash = HashPassword(model.Password); var update = _userManager.Update(user); return(RedirectToAction("Login", "Account")); //if (result.Succeeded) //{ // return RedirectToAction("Login", "Account"); //} //AddErrors(result); return(View()); } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Account"; logVm.View = "ResetPassword"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
public async Task <ActionResult> Register(RegisterViewModel model) { try { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await _userManager.SendEmailAsync(user.Id, "Confirme sua Conta", "Por favor confirme sua conta clicando neste link: <a href='" + callbackUrl + "'></a>"); ViewBag.Link = callbackUrl; return(View("DisplayEmail")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Account"; logVm.View = "Register"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
public async Task <ActionResult> Index(LogViewModel model) { model.Search = model.Search ?? string.Empty; model.Application = !string.IsNullOrEmpty(model.Application) ? model.Application : CcmApplications.Web; model.SelectedLastOption = !string.IsNullOrEmpty(model.SelectedLastOption) ? model.SelectedLastOption : GetLastOptions().First().Value; model.StartDateTime = model.StartDateTime > DateTime.MinValue ? model.StartDateTime : DateTime.Now.AddHours(-6); model.EndDateTime = model.EndDateTime > DateTime.MinValue ? model.EndDateTime : DateTime.Now; model.Rows = model.Rows > 0 ? model.Rows : 25; DateTime?startTime; DateTime?endTime; if (model.SelectedLastOption == "interval") { startTime = model.StartDateTime; endTime = model.EndDateTime; } else { var ts = TimeSpan.Parse(model.SelectedLastOption); startTime = DateTime.Now.Subtract(ts); endTime = null; } string logLevelCcm = LogLevelManager.GetCurrentLevel().Name; string logLevelDiscovery = await GetDiscoveryLogLevelAsync(); ViewBag.CurrentLevelCCM = logLevelCcm; ViewBag.CurrentLevelDiscovery = logLevelDiscovery; model.LogRows = await _logRepository.GetLastAsync(model.Rows, model.Application, startTime, endTime, model.SelectedLevel, model.Search, model.ActivityId); model.LastOptions = GetLastOptions(); model.Levels = LogLevel.AllLoggingLevels.ToList().Select(l => new SelectListItem() { Value = l.Ordinal.ToString(), Text = l.Name }); return(View(model)); }
public MainWindow() { this.InitializeComponent(); this.client = new DebugClient(this.events); var logViewModel = new LogViewModel(this.events, this.client) { Conductor = this.conductor }; var mainViewModel = new MainViewModel(this.events, this.client) { Conductor = this.conductor, LogViewModel = logViewModel }; this.Log.Sorting += this.Log_Sorting; this.DataContext = mainViewModel; this.client.Connect("localhost", this.app.Port); this.Closing += (sender, e) => e.Cancel = !mainViewModel.Cleanup(); }
public ActionResult Pagamento(string token, string amt, string cc, string item_name, string st, string tx) { try { if (st.Equals("Completed")) { var separarId = item_name.Split('-'); var id = separarId[1]; var orcamento = _orcamentoApp.GetById(int.Parse(id)); var prestador = _prestadorApp.GetPorGuid(Guid.Parse(_userId)); orcamento.PrestadorFk = new List <Prestador>(); orcamento.PrestadorFk.Add(prestador); prestador.OrcamentoFk = new List <Orcamento>(); prestador.OrcamentoFk.Add(orcamento); _prestadorApp.Update(prestador); _orcamentoApp.Update(orcamento); return(RedirectToAction("Detalhes", new { id = id, usuarioId = _userId })); } return(View()); } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Orçamento"; logVm.View = "Pagamento"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
public void Exit() { IPersister persister = _container.Get <IPersister>(); string characterName = ViewModelBase.FFACE?.Player?.Name; string characterJob = ViewModelBase.FFACE?.Player?.Job.ToString(); string fileName = $"{characterName}.eup"; if (!String.IsNullOrWhiteSpace(fileName)) { persister.Serialize(fileName, Config.Instance); } fileName = $"{characterName}-{characterJob}.eup"; if (!String.IsNullOrWhiteSpace(fileName)) { persister.Serialize(fileName, Config.Instance); } LogViewModel.Write("Application exiting"); }
public void Log(LogViewModel model) { Log entity = new Log { Message = model.Message, Date = model.LogDate, UserId = model.UserId, Action = model.Action, TargetName = model.TargetName, Controller = model.Controller, Method = model.Method, Status = model.Status, OldValue = model.OldValue, NewValue = model.NewValue, TargetId = model.TargetId, Fullname = model.Fullname, UserCode = model.UserCode }; unitOfWork.Repository <Log>().Insert(entity); unitOfWork.SaveChanges(); }
public ActionResult BuscaTrabalhos(string usuarioId) { try { _userId = usuarioId; var prestador = _prestadorApp.GetPorGuid(Guid.Parse(usuarioId)); ViewBag.Nome = prestador.pres_Nome; ViewBag.CaminhoFoto = prestador.caminho_foto; ViewBag.UsuarioId = prestador.pres_Id; ViewBag.ListaCat = new SelectList(_categoriaApp.GetAll(), "cat_Id", "cat_Nome"); var orcamentoVm = Mapper.Map <IEnumerable <Orcamento>, IEnumerable <OrcamentoViewModel> > (_orcamentoApp.RetornarOrcamentosComDistanciaCalculada(prestador.pres_latitude, prestador.pres_longitude, prestador.pres_Raio_Recebimento, prestador.pres_Id)); string frase; var orcamentoViewModels = orcamentoVm as OrcamentoViewModel[] ?? orcamentoVm.ToArray(); if (orcamentoViewModels.Count() == 1) { frase = "Foi encontrado " + orcamentoViewModels.Count().ToString() + " orçamento."; } else { frase = "Foram encontrados " + orcamentoViewModels.Count().ToString() + " orçamentos"; } ViewBag.FraseQtd = frase; return(View(orcamentoVm)); } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Orçamento"; logVm.View = "BuscaTraballhos"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
public IActionResult OperatingLogs() { var models = new List <LogViewModel>(); var logs = context.DBLogs.Where(log => log.LogType == "Operate"); foreach (var log in logs) { var model = new LogViewModel { Id = log.Id, Operatingtime = log.Operatingtime, UserName = log.UserName, Identity = log.Identity, Requesturl = log.Requesturl, Method = log.Method, Message = log.Message, InputValue = log.CustomProperty }; models.Add(model); } return(View(models)); }
public ActionResult Login(LogViewModel model, string returnUrl) { if (ModelState.IsValid) { if (ValidateUser(model.UserName, model.Password)) { if (Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Request")); } } else { ModelState.AddModelError("", "Неправильный пароль или логин"); } } return(View(model)); }
public LogView() { InitializeComponent(); trimChars = new char[1]; trimChars[0] = '\n'; //logTextBox.Document.PageWidth = System.Windows.SystemParameters.PrimaryScreenWidth; Loaded += new RoutedEventHandler((o, e) => { logTextBox.ScrollToEnd(); }); Closing += LogView_Closing; VisualAppender visualAppender = (VisualAppender)LogManager.GetRepository().GetAppenders().Single(t => t.Name.Equals("VisualAppender")); DataContext = ViewModel = visualAppender.LogViewModel; lock (ViewModel.MessagesLock) { foreach (LogMessageModel message in ViewModel.Messages) { addMessage(message); } } ViewModel.Messages.CollectionChanged += messagesCollectionChangedCallback; ViewModel.LogLevel.CurrentChanged += LogLevel_CurrentChanged; using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("MediaViewer.Logging.LogSyntaxHighlighting.xshd")) { using (XmlTextReader reader = new XmlTextReader(s)) { logTextBox.SyntaxHighlighting = HighlightingLoader.Load(reader, HighlightingManager.Instance); } } }
public ActionResult Detalhes(OrcamentoViewModel orcamentoVm, string usuarioId) { try { var orcamentoEntity = Mapper.Map <OrcamentoViewModel, Orcamento>(orcamentoVm); orcamentoEntity.Status = EnumClass.EnumStatusOrcamento.Fechado; _orcamentoApp.Update(orcamentoEntity); return(RedirectToAction("BuscaTrabalhos", new { usuarioId })); } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Orçamento"; logVm.View = "Detalhes Post"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
public async Task <ActionResult> VerifyCode(VerifyCodeViewModel model) { try { if (ModelState.IsValid) { var result = await _signInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent : model.RememberMe, rememberBrowser : model.RememberBrowser); switch (result) { case SignInStatus.Success: return(RedirectToLocal(model.ReturnUrl)); case SignInStatus.LockedOut: return(View("Lockout")); case SignInStatus.Failure: default: ModelState.AddModelError("", "Código Inválido."); return(View(model)); } } else { return(View(model)); } } catch (Exception e) { var logVm = new LogViewModel(); logVm.Mensagem = e.Message; logVm.Controller = "Account"; logVm.View = "VerifyCode"; var log = Mapper.Map <LogViewModel, Log>(logVm); _logAppService.SaveOrUpdate(log); return(RedirectToAction("ErroAoCadastrar")); } }
private JObject ParseSpreadsheet() { Logs.Add(LogViewModel.Log($"Opening {SpreadsheetPath}...")); // Read excel sheet and create json from here... if (!File.Exists(SpreadsheetPath)) { Logs.Add(LogViewModel.Error("Invalid path. Please choose a spreadsheet to parse.")); return(null); } ExcelPackage package; try { package = new ExcelPackage(new FileInfo(SpreadsheetPath)); } catch (System.Exception) { Logs.Add(LogViewModel.Error("Couldn't open file. Please make sure that the file " + "is not being blocked by another application.")); return(null); } var json = new JObject(); // parse cards tab by tab ParseSheet(json, "resources", package.Workbook.Worksheets["Resources"], ParseResources); ParseSheet(json, "events", package.Workbook.Worksheets["Events"], ParseEvents); ParseSheet(json, "communal_responsibilities", package.Workbook.Worksheets["CommunalResps"], ParseCommunalResponsibilities); ParseSheet(json, "family_responsibilities", package.Workbook.Worksheets["FamilyResps"], ParseFamilyResponsibilities); ParseSheet(json, "roles", package.Workbook.Worksheets["Roles"], ParseRoles); // close package package.Dispose(); return(json); }
public ActionResult Login(LogViewModel model, string returnUrl) { if (ModelState.IsValid) { if (ValidateUser(model.UserName, model.Password)) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Sales"); } } else { ModelState.AddModelError("", "Неправильный пароль или логин"); } } return View(model); }
public ApplicationController(Lazy<ShellViewModel> shellViewModelLazy, Lazy<SettingsViewModel> settingsViewModelLazy, Lazy<AboutViewModel> aboutViewModelLazy, Lazy<HelpViewModel> helpViewModelLazy, Lazy<LogViewModel> logViewModelLazy, Lazy<ShellService> shellServiceLazy, CompositionContainer compositionContainer, Lazy<IAccountAuthenticationService> accountAuthenticationServiceLazy, IShellController shellController, Lazy<SystemTrayNotifierViewModel> lazySystemTrayNotifierViewModel, IGuiInteractionService guiInteractionService, ILogController logController) { //ViewModels _shellViewModel = shellViewModelLazy.Value; _settingsViewModel = settingsViewModelLazy.Value; _aboutViewModel = aboutViewModelLazy.Value; _helpViewModel = helpViewModelLazy.Value; _logViewModel = logViewModelLazy.Value; _systemTrayNotifierViewModel = lazySystemTrayNotifierViewModel.Value; //Commands _shellViewModel.Closing += ShellViewModelClosing; _exitCommand = new DelegateCommand(Close); //Services AccountAuthenticationService = accountAuthenticationServiceLazy.Value; _shellService = shellServiceLazy.Value; _shellService.ShellView = _shellViewModel.View; _shellService.SettingsView = _settingsViewModel.View; _shellService.AboutView = _aboutViewModel.View; _shellService.HelpView = _helpViewModel.View; _shellService.LogView = _logViewModel.View; _shellController = shellController; _guiInteractionService = guiInteractionService; _logController = logController; if (_shellViewModel.IsSettingsVisible) { _settingsViewModel.Load(); } }
protected LogFilterState(LogViewModel vm) { }
public void OpenLogWindow() { var logWindow = WindowManager.FindWindow(typeof(LogViewModel)) as LogViewModel; this.LogWindowOpen = true; if (logWindow == null) { logWindow = new LogViewModel(); logWindow.Closing = () => { this.LogWindowOpen = false; }; WindowManager.OpenWindow(logWindow, this.main); } else { WindowManager.FocusWindow(logWindow); } }
// GET: Log public ActionResult Index() { var model = new LogViewModel { LogLevel = LoggingLevel.Warn }; if (Session["LogLevel"] != null) { model.LogLevel = (LoggingLevel)Session["LogLevel"]; } return View(model); }
protected async override void OnInitialize() { this.LogView = new LogViewModel(); this.DisplayName = TITLE; this.IsAutoRefreshEnabled = Properties.Settings.Default.AutoRefresh; this.IsLoadLastOnStartupEnabled = Properties.Settings.Default.LoadLastOnStartup; this.IsStripMultiLinesInList = Properties.Settings.Default.StripMultiLinesInList; string[] mruFilesArray = JsonConvert.DeserializeObject<string[]>(Properties.Settings.Default.MruFiles); this.mruFiles.AddRange(mruFilesArray); await Task.Delay(250); this.IsLoading = false; var lastLogFile = Properties.Settings.Default.LastLogfile; if ((this.IsLoadLastOnStartupEnabled) && (!String.IsNullOrWhiteSpace(lastLogFile))) { if (File.Exists(lastLogFile)) { log.InfoFormat("Loading last-used logfile: '{0}'", lastLogFile); OpenLogFile(lastLogFile, false); } else { log.WarnFormat("Could not open last-used logfile, does not seem to exist any more: '{0}'", lastLogFile); } } }
public FilterByUserState(LogViewModel viewModel) : base(viewModel) { _logViewModel = viewModel; Name = "По пользователю"; }
public ActionResult Index(LogViewModel model) { Session["LogLevel"] = model.LogLevel; ReconfigureLogLevel(model.LogLevel); return RedirectToAction("Index"); }
public FilterByRangeDateState(LogViewModel viewModel) : base(viewModel) { _logViewModel = viewModel; Name = "По дате"; }
public LogController(LogViewModel logViewModel) { LogViewModel = logViewModel; }
private static LogViewModel LoadLogViewModel(string logFilename, IFileSystem fileSystem, IAgentSettings agentSettings, bool includeContents, string subFolder=null) { string logDirectory = ""; if (string.IsNullOrWhiteSpace(subFolder)) { logDirectory = GetLogDirectory(agentSettings); } else { logDirectory = Path.Combine(GetLogDirectory(agentSettings), subFolder); } var logFilePath = Path.Combine(logDirectory, logFilename); if (!fileSystem.File.Exists(logFilePath)) { throw new ArgumentOutOfRangeException("filename"); } var fileInfo = fileSystem.FileInfo.FromFileName(logFilename); var viewModel = new LogViewModel() { LogFileName = fileInfo.Name, Group = subFolder ?? "server", DateCreated = fileSystem.File.GetCreationTime(logFilePath), DateModified = fileSystem.File.GetLastWriteTime(logFilePath) }; if (includeContents) { using (var stream = new FileStream(logFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using (var reader = new StreamReader(stream)) { viewModel.LogContents = reader.ReadToEnd(); } } return viewModel; }
public NormalFilterState(LogViewModel viewModel) : base(viewModel) { _logViewModel = viewModel; Name = "Весь лог"; }