public void Collapse(SessionListItem item) { var selItem = SelectedItem as SessionListItem; if (selItem?.Session?.Parent == item.Session) { var parentItem = Tree.GetItem(item.Session); SelectedIndex = Tree.IndexOf(parentItem); } Tree.Collapse(Tree.IndexOf(item)); }
public void Expand(SessionListItem item) { Tree.Expand(Tree.IndexOf(item)); }
public TreeToggleRoutedEventArgs(RoutedEvent routedEvent, SessionListItem item) : base(routedEvent) { Item = item; }
private SessionListItem populteListItem(LogViewModel data) { var listItem = new SessionListItem(); listItem.Version = data.GetPMDLProStatusString1; var expireDate = new DateTime(); DateTime.TryParse(data.RegistryExpireDate, out expireDate); listItem.LicenseExpireDate = expireDate == DateTime.MinValue ? TextResources.InvalidDate : $"{expireDate.ToUniversalTime().Humanize(culture: new CultureInfo("fa-IR"))} ({new PersianDateTime(expireDate).ToLongDateString()})"; listItem.ClientIp = Request.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString(); listItem.Number = ClientSessions.SessionsList.Count + 1; if (data.IsPMDLProRunning) { listItem.IsRunning = TextResources.Running; } else if (data.IsPMDLProRunning) { listItem.IsRunning = TextResources.Stoped; } var currentServerNameMapping = ClientSessions.SessionsList .FirstOrDefault(client => client.ServerID == data.RegistryServerID.ToString())?.ServerName; listItem.ServerName = currentServerNameMapping != null ? currentServerNameMapping : TextResources.ServerNameNotAvailable; data.ServerName = listItem.ServerName; listItem.OrganizationId = data.RegistryOrgID.ToString(); listItem.HardwareId = data.GetPMDLProStatusString2; listItem.ServerID = data.RegistryServerID.ToString(); int protectionStatus = Constants.PMDLProStatusDriverNotLoaded; if (int.TryParse(data.GetPMDLProStatusString0.ToString(), out int parsedProtectionStatus)) { protectionStatus = parsedProtectionStatus; } if (string.IsNullOrEmpty(data.RegistryPassword.ToString())) { protectionStatus = Constants.PMDLProStatusNotConfigured; } if (protectionStatus < Constants.PMDLProStatusNotActive && protectionStatus > Constants.PMDLProStatusDisabledBecauseOfLicense) { listItem.ProtectionStatus = TextResources.InvalidOrExpiredLicense; } switch (protectionStatus) { case Constants.PMDLProStatusDisabledBecauseOfLicense: listItem.ProtectionStatus = TextResources.DisabledBecauseOfLicense; break; case Constants.PMDLProStatusNotActive: listItem.ProtectionStatus = TextResources.NotActive; break; case Constants.PMDLProStatusDiskCryptOnly: listItem.ProtectionStatus = TextResources.DiskCryptOnly; break; case Constants.PMDLProStatusReadOnlyDiskCrypt: listItem.ProtectionStatus = TextResources.ReadOnlyDiskCrypt; break; case Constants.PMDLProStatusFullProtection: listItem.ProtectionStatus = TextResources.FullProtection; break; case Constants.PMDLProStatusDriverNotLoaded: listItem.ProtectionStatus = TextResources.DriverNotRunning; listItem.Version = TextResources.NotAvailable; break; case Constants.PMDLProStatusNotConfigured: listItem.ProtectionStatus = TextResources.NotConfigured; break; default: break; } listItem.Status = protectionStatus; return(listItem); }