コード例 #1
0
        /// <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);
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
 public ControllerBase([CreateNew] IController parent)
 {
     Parent      = parent;
     Controllers = new ControllerCache(parent);
     Services    = new ServiceCache(parent);
     Views       = new ViewCache(parent);
 }
コード例 #4
0
ファイル: UserViews.cs プロジェクト: zhiqiang-hu/scada
        /// <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>();
        }
コード例 #5
0
ファイル: Routes.cs プロジェクト: Datasilk/Kandu
 public override IService FromServiceRoutes(HttpContext context, Parameters parameters, string name)
 {
     if (App.Environment == Environment.development)
     {
         ViewCache.Clear();
     }
     return(null);
 }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        public INavigationView <IViewModelWithResultHandler> GetView([NotNull] IViewModelWithResultHandler viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            return(ViewCache.Get <INavigationView <IViewModelWithResultHandler>, IViewModelWithResultHandler>(viewModel));
        }
コード例 #8
0
        /// <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));
        }
コード例 #9
0
        public static IView <IViewModel> Get([NotNull] IViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            return(ViewCache.Get <IView <IViewModel>, IViewModel>(viewModel));
        }
コード例 #10
0
ファイル: RightsChecker.cs プロジェクト: hhdang/RapidScada
        /// <summary>
        /// Конструктор
        /// </summary>
        public RightsChecker(ViewCache viewCache)
        {
            if (viewCache == null)
            {
                throw new ArgumentNullException("viewCache");
            }

            this.viewCache = viewCache;
        }
コード例 #11
0
        /// <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));
        }
コード例 #12
0
        /// <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));
        }
コード例 #13
0
        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));
        }
コード例 #14
0
        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));
        }
コード例 #15
0
ファイル: Routes.cs プロジェクト: Datasilk/Kandu
        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);
        }
コード例 #16
0
        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));
                    }
                }
            });
        }
コード例 #17
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public UserRights(ViewCache viewCache)
 {
     this.viewCache = viewCache;
     SetToDefault();
 }
コード例 #18
0
ファイル: InstantVisualStudio.cs プロジェクト: ermau/Instant
		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);
			}
		}
コード例 #19
0
 partial void OnUnloadedPartial()
 {
     ViewCache?.OnUnloaded();
 }
 public CalendarController() : base()
 {
     _currentDay   = DateTime.MinValue;
     _dayViewCache = new ViewCache(new ViewFactory());
 }
 public CalendarController() : base()
 {
     _currentDay   = DateTime.MinValue;
     _dayViewCache = new ViewCache(new ViewFactory());
 }
コード例 #22
0
 public INavigationView <IViewModel> GetLastNavigatedView()
 {
     return(ViewCache.GetLastOrDefault <INavigationView <IViewModel> >());
 }