/// <summary> /// Получить список пар канал/представление по ид. представления /// </summary> public static List <CnlViewPair> GetCnlViewPairsByView( int viewID, DataAccess dataAccess, ViewCache viewCache, UserViews userViews) { BaseView view = null; if (viewID > 0) { Type viewType = userViews.GetViewType(viewID); view = viewCache.GetView(viewType, viewID); } if (view == null) { return(null); } else { List <CnlViewPair> cnlsByView = new List <CnlViewPair>(); foreach (int cnlNum in view.CnlList) { CnlViewPair pair = new CnlViewPair(cnlNum, 0); pair.FillInfo(dataAccess.GetCnlProps(cnlNum), null); cnlsByView.Add(pair); } return(cnlsByView); } }
private void lvLogInfo_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { try { if (_cookie != null) { FillCache(e.ItemIndex); if (ViewCache.ContainsKey(e.ItemIndex)) { var dto = ViewCache[e.ItemIndex]; e.Item = new ListViewItem(dto.getClientIP()); e.Item.SubItems.Add(dto.getClientPort().ToString()); e.Item.SubItems.Add(dto.getLoginDN()); e.Item.SubItems.Add(dto.getOperation()); e.Item.SubItems.Add(dto.getErrorCode().ToString()); var span = dto.getEndTime() - dto.getStartTime(); e.Item.SubItems.Add(string.Format("{0} ms", span)); } } } catch (Exception exp) { MessageBox.Show(exp.ToString()); } }
public ControllerBase([CreateNew] IController parent) { Parent = parent; Controllers = new ControllerCache(parent); Services = new ServiceCache(parent); Views = new ViewCache(parent); }
/// <summary> /// Конструктор /// </summary> public UserViews(ViewCache viewCache, Log log) { this.viewCache = viewCache ?? throw new ArgumentNullException("viewCache"); this.log = log ?? throw new ArgumentNullException("log"); viewNodeDict = new Dictionary <int, ViewNode>(); ViewNodes = new List <ViewNode>(); }
public override IService FromServiceRoutes(HttpContext context, Parameters parameters, string name) { if (App.Environment == Environment.development) { ViewCache.Clear(); } return(null); }
/// <summary> /// Создать объекты доступа к данным /// </summary> private void CreateDataObjects() { ServerComm = new ServerComm(WebSettings.CommSettings, Log); DataCache dataCache = new DataCache(ServerComm, Log); DataAccess = new DataAccess(dataCache, Log); ViewCache = new ViewCache(ServerComm, DataAccess, Log); }
public INavigationView <IViewModelWithResultHandler> GetView([NotNull] IViewModelWithResultHandler viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <INavigationView <IViewModelWithResultHandler>, IViewModelWithResultHandler>(viewModel)); }
/// <summary> /// Returns an existing <see cref="INavigationView{TViewModel}"/> instance by <paramref name="viewModel"/> that can handle a lifecycle-aware view model result. /// </summary> /// <param name="viewModel">The view model that is used to get its view.</param> /// <returns>The navigation view instance.</returns> /// <exception cref="ArgumentNullException"><paramref name="viewModel"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The view instance is missing for the provided <paramref name="viewModel"/>.</exception> public static INavigationView <ILifecycleViewModelWithResultHandler> Get(ILifecycleViewModelWithResultHandler viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <INavigationView <ILifecycleViewModelWithResultHandler>, ILifecycleViewModelWithResultHandler>(viewModel)); }
public static IView <IViewModel> Get([NotNull] IViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <IView <IViewModel>, IViewModel>(viewModel)); }
/// <summary> /// Конструктор /// </summary> public RightsChecker(ViewCache viewCache) { if (viewCache == null) { throw new ArgumentNullException("viewCache"); } this.viewCache = viewCache; }
/// <summary> /// Returns an existing <see cref="INavigationView{TViewModel}"/> instance by <paramref name="viewModel"/> that can return a lifecycle-aware view model result. /// </summary> /// <typeparam name="TResult">The type of the view model result.</typeparam> /// <param name="viewModel">The view model that is used to get its view.</param> /// <returns>The navigation view instance.</returns> /// <exception cref="ArgumentNullException"><paramref name="viewModel"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The view instance is missing for the provided <paramref name="viewModel"/>.</exception> public static INavigationView <ILifecycleViewModelWithResult <TResult> > Get <TResult>(ILifecycleViewModelWithResult <TResult> viewModel) where TResult : Result { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <INavigationView <ILifecycleViewModelWithResult <TResult> >, ILifecycleViewModelWithResult <TResult> >(viewModel)); }
/// <summary> /// Returns an existing navigation <typeparamref name="TView"/> derived from the <see cref="Fragment"/> by <paramref name="viewModel"/>. /// </summary> /// <typeparam name="TView">The type of the view.</typeparam> /// <typeparam name="TViewModel">The type of the view model.</typeparam> /// <param name="viewModel">The view model that is used to get its view.</param> /// <returns>The navigation view instance.</returns> /// <exception cref="ArgumentNullException"><paramref name="viewModel"/> is <see langword="null"/>.</exception> /// <exception cref="InvalidOperationException">The view instance is missing for the provided <paramref name="viewModel"/>.</exception> public static TView GetFragment <TView, TViewModel>(TViewModel viewModel) where TView : Fragment, INavigationView <TViewModel> where TViewModel : class, ILifecycleViewModel { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <TView, TViewModel>(viewModel)); }
public TView GetFragment <TView, TViewModel>([NotNull] TViewModel viewModel) where TView : Android.Support.V4.App.Fragment, INavigationView <TViewModel> where TViewModel : class, IViewModel { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <TView, TViewModel>(viewModel)); }
public TView GetViewController <TView, TViewModel>([NotNull] TViewModel viewModel) where TView : UIViewController, INavigationView <TViewModel> where TViewModel : class, IViewModel { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } return(ViewCache.Get <TView, TViewModel>(viewModel)); }
public override IController FromControllerRoutes(HttpContext context, Parameters parameters, string name) { if (App.Environment == Environment.development) { ViewCache.Clear(); } switch (name) { case "": case "home": return(new Controllers.Home()); case "login": return(new Controllers.Login()); case "boards": return(new Controllers.Boards()); case "board": return(new Controllers.Board()); case "import": return(new Controllers.Import()); } return(null); }
private void lvLogInfo_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { MiscUtilsService.CheckedExec(delegate { if (_cookie != null) { FillCache(e.ItemIndex); if (ViewCache.ContainsKey(e.ItemIndex)) { var dto = ViewCache[e.ItemIndex]; e.Item = new ListViewItem(dto.getClientIP()); e.Item.SubItems.Add(dto.getClientPort().ToString()); e.Item.SubItems.Add(dto.getLoginDN()); e.Item.SubItems.Add(dto.getOperation()); e.Item.SubItems.Add(dto.getErrorCode().ToString()); var span = dto.getEndTime() - dto.getStartTime(); e.Item.SubItems.Add(string.Format("{0} ms", span)); } } }); }
/// <summary> /// Конструктор /// </summary> public UserRights(ViewCache viewCache) { this.viewCache = viewCache; SetToDefault(); }
private void AdornOperationContainer (OperationContainer container, ITextSnapshot snapshot, LineMap lineMap, CancellationToken cancelToken) { foreach (Operation operation in container.Operations) { SnapshotSpan span; if (!lineMap.TryGetSpan (this.view.TextSnapshot, operation.Id, out span)) continue; Geometry g = this.view.TextViewLines.GetMarkerGeometry (span); if (g == null) continue; Type opType = operation.GetType(); OperationVisuals vs; if (!Mapping.TryGetValue (opType, out vs)) continue; ViewCache viewCache; if (!views.TryGetValue (opType, out viewCache)) views[opType] = viewCache = new ViewCache (vs); InstantView adorner; bool preexisted = viewCache.TryGetView (out adorner); if (!preexisted) { adorner.FontSize = FontSize - 1; adorner.FontFamily = FontFamily; adorner.BorderBrush = BorderBrush; adorner.Foreground = Foreground; } adorner.Tag = operation.Id; OperationViewModel model = adorner.DataContext as OperationViewModel; if (model == null) adorner.DataContext = model = vs.CreateViewModel(); model.Operation = operation; if (operation is Loop) { var loopModel = (LoopViewModel)model; LoopIteration[] iterations = loopModel.Iterations; if (!preexisted || loopModel.Iteration > iterations.Length) loopModel.Iteration = iterations.Length; if (!preexisted) loopModel.IterationChanged += OnIterationChanged; if (iterations.Length > 0) AdornOperationContainer (iterations[loopModel.Iteration - 1], snapshot, lineMap, cancelToken); } Canvas.SetLeft (adorner, g.Bounds.Right + 10); Canvas.SetTop (adorner, g.Bounds.Top + 1); adorner.Height = g.Bounds.Height - 2; adorner.MaxHeight = g.Bounds.Height - 2; if (!preexisted) this.layer.AddAdornment (AdornmentPositioningBehavior.TextRelative, span, null, adorner, OperationAdornerRemoved); } }
partial void OnUnloadedPartial() { ViewCache?.OnUnloaded(); }
public CalendarController() : base() { _currentDay = DateTime.MinValue; _dayViewCache = new ViewCache(new ViewFactory()); }
public INavigationView <IViewModel> GetLastNavigatedView() { return(ViewCache.GetLastOrDefault <INavigationView <IViewModel> >()); }