protected override void AttachBehaviors(IRegion region, Selector regionTarget)
        {
            base.AttachBehaviors(region, regionTarget);

            OutlookBarPublishBehavior behavior = new OutlookBarPublishBehavior(regionTarget, eventAggregator);
            behavior.Attach();
        }
        protected override void Adapt(IRegion region, Selector regionTarget)
        {
            if (!(regionTarget is OutlookBarControl))
                throw new ArgumentException(Resources.RegionTargetNotValidException);

            base.Adapt(region, regionTarget);
        }
			public void Add(IRegion region)
			{
				if (region.Name == null)
				{
					throw new InvalidOperationException("Region name cannot be empty");
				}

				if (this.GetRegionByName(region.Name) != null)
				{
					throw new ArgumentException("Region already exists: " + region.Name);
				}

				var r = region as Region;
				if (r != null)
				{
					if (r.RegionManager != null)
					{
						throw new ArgumentException("Region is already associated with a region manager");
					}
					r.RegionManager = _regionManager;

					string regionName = region.Name;
					r.RegionClosed += delegate { Remove(regionName); };
				}

				_regions.Add(region);
			}
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            isConstValueTypeLoad = false;
            this.cmbCustomerTop.InnerDropDownList.Load += new EventHandler(cmbCustomerTop_Load);
            
            iRegion = ServiceAgent.getInstance().GetMaintainObjectByName<IRegion>(WebConstant.IRegion);
            pmtMessage1 = this.GetLocalResourceObject(Pre + "_pmtMessage1").ToString();
            pmtMessage2 = this.GetLocalResourceObject(Pre + "_pmtMessage2").ToString();
            pmtMessage3 = this.GetLocalResourceObject(Pre + "_pmtMessage3").ToString();
            pmtMessage4 = this.GetLocalResourceObject(Pre + "_pmtMessage4").ToString();
            pmtMessage5 = this.GetLocalResourceObject(Pre + "_pmtMessage5").ToString();
            pmtMessage6 = this.GetLocalResourceObject(Pre + "_pmtMessage6").ToString();
            if (!this.IsPostBack)
            {
                userName = Master.userInfo.UserId;
                this.HiddenUserName.Value = userName;
                initLabel();
                initcustomer();
                bindTable(null, DEFAULT_ROWS);
            }

            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "InitControl", "initControls();", true);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
        }
    }
Example #5
0
        public LoginController(IEventAggregator eventAggregator, 
            IRegionManager regionManager, ILoginView view, ILinqApi api, ICredentialsStore store, IAsyncManager manager)
        {
            eventAggregator.GetEvent<InitialViewActivatedEvent>().Subscribe(
                DoLogin);

            this.region = regionManager.Regions[RegionNames.DialogRegion];

            this.eventAggregator = eventAggregator;
            this.view = view;
            this.api = api;
            this.store = store;
            this.manager = manager;
            this.region.Add(this.view);

            this.username = store.Username;
            this.password = store.Password;

            this.view.DataContext = this;

            this.provideCredentialsCommand =
                new DelegateCommand<object>(this.ProvideCredentials,
                                            o =>
                                            !(String.IsNullOrEmpty(this.Username) ||
                                              String.IsNullOrEmpty(this.Password)));
        }
 public ReplayRecorder(IRegion region, string gameId,string encKey)
 {
     GameId = gameId;
     EncKey = encKey;
     writer = new ReplayWriter(region,gameId);
     Getter = new Getter(region, gameId);
 }
 public HeaderRegionController(IUnityContainer container, IEventAggregator eventAggregator, 
     [Dependency(ShellRegionNames.HeaderRegion)] IRegion headerRegion)
 {
     _container = container;
     _eventAggregator = eventAggregator;
     _headerRegion = headerRegion;
 }
Example #8
0
		public Constructor(Modifier m, IRegion region, IRegion bodyRegion)
		{
			FullyQualifiedName = "ctor";
			this.region     = region;
			this.bodyRegion = bodyRegion;
			modifiers = (ModifierEnum)m;
		}
Example #9
0
 public Field(ReturnType type, string fullyQualifiedName, Modifier m, IRegion region)
 {
     this.returnType = type;
     this.FullyQualifiedName = fullyQualifiedName;
     this.region = region;
     modifiers = (ModifierEnum)m;
 }
Example #10
0
 public Class(CompilationUnit cu, ClassType t, Modifier m, IRegion region)
 {
     this.cu = cu;
     classType = t;
     this.region = region;
     modifiers = (ModifierEnum)m;
 }
Example #11
0
 protected override void DeleteRegionCore(IRegion region)
 {
     BetaRegion r = region as BetaRegion;
     if (r != null) {
         r.Dispose();
     }
 }
Example #12
0
 public RegionDisplayItem(IRegion region)
 {
     Id = region.Id;
     Name = region.Name;
     AverageCTDI = region.DRL_CTDI;
     AverageDLP = region.DRL_DLP;
 }
 public MenuRegionController(IUnityContainer container,
     [Dependency(ShellRegionNames.MenuRegion)] IRegion menuRegion)
 {
     _container = container;
     _eventAggregator = _container.Resolve<IEventAggregator>();
     _menuRegion = menuRegion;
 }
 public Destructor(string className, Modifier m, IRegion region, IRegion bodyRegion)
 {
     FullyQualifiedName = "~" + className;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
Example #15
0
 public PageRegionViewModel(IRegion region)
 {
     if (region != null)
     {
         RegionId = region.Id;
         RegionIdentifier = region.RegionIdentifier;
     }
 }
Example #16
0
		public Property(string fullyQualifiedName, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion)
		{
			this.FullyQualifiedName = fullyQualifiedName;
			returnType = type;
			this.region = region;
			this.bodyRegion = bodyRegion;
			modifiers = (ModifierEnum)m;
		}
        public void Initialize()
        {
            window = new Window();
            adapter = new WindowRegionAdapter();
            region = adapter.Initialize(window);

            window.Show();
        }
Example #18
0
        /// <summary>
        ///     Attaches all necesary event handlers, sets bindings an properties
        /// </summary>
        /// <param name="region">Region to attach to</param>
        /// <param name="regionHost">Region host to attach to</param>
        /// <exception cref="ArgumentNullException">
        ///     When <paramref name="region"/> or <paramref name="regionHost"/> is null
        /// </exception>
        /// <exception cref="InvalidOperationException">
        ///     When <paramref name="region"/> or <paramref name="regionHost"/> do not 
        ///     meet requirements of this <see cref="IRegionBehavior"/>
        /// </exception>
        public void Attach(IRegion region, DependencyObject regionHost)
        {
            if (region == null) throw new ArgumentNullException("region");
            if (regionHost == null) throw new ArgumentNullException("regionHost");

            region.ActiveViews.CollectionChanged +=
                RegionActiveViewsChanged;
        }
Example #19
0
 public Method(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion)
 {
     FullyQualifiedName = name;
     returnType = type;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
Example #20
0
 public Indexer(ReturnType type, ParameterCollection parameters, Modifier m, IRegion region, IRegion bodyRegion)
 {
     returnType      = type;
     this.parameters = parameters;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
Example #21
0
 public Field(ReturnType type, string fullyQualifiedName, Modifier m, IRegion region)
 {
     this.returnType = type;
     this.FullyQualifiedName = fullyQualifiedName;
     this.region = region;
     modifiers = (ModifierEnum)m;
     //			Console.WriteLine("modifiers for field {0} are {1} were {2}", fullyQualifiedName, modifiers, m);
 }
Example #22
0
 public void before_each()
 {
     logProvider = MockRepository.GenerateStub<ILogProvider>();
     logSourceView = MockRepository.GenerateStub<ILogSourceView>();
     regionManager = MockRepository.GenerateStub<IRegionManager>();
     region = MockRepository.GenerateMock<IRegion>();
     regionManager.Stub(x => x.Regions[null]).IgnoreArguments().Return(region);
 }
Example #23
0
 /// <summary>
 /// Добавить контуры другого региона, применив к ним трансформацию.
 /// </summary>
 /// <param name="region">Регион, из которого будут копироваться контуры.</param>
 /// <param name="trans">Трансформация, которая будет применяться к контурам.</param>
 public void AddWithTransform(IRegion region, Transform trans)
 {
     foreach (IContour cont in region.Contours)
     {
         BasicContour ncont = new BasicContour();
         ncont.AddWithTransform(cont, trans);
         DrawningContours.Add(ncont);
     }
 }
 public RegionController(IRegionRepository repository, IUnitOfWork unitOfWork,IRegion region, IRegionManager manager)
 {
     _repository = repository;
     _unitOfWork = unitOfWork;
     _repository.UnitOfWork = unitOfWork;
     _region = region;
     _manager = manager;
     _manager.RegionRepository = _repository;
 }
Example #25
0
 public WishView(IRegion mainRegion)
 {
     InitializeComponent();
     SetInputGestures();
     SetSyntaxHighlighting();
     _mainRegion = mainRegion;
     _wishModel = new WishModel();
     _state = new Normal(_wishModel);
 }
Example #26
0
        public void SetUp()
        {
            _region = new Mock<IRegion>().Object;
            _view = new DependencyObject();

            _regionFactoryMock = new Mock<IRegionFactory>(MockBehavior.Strict);
            _regionManager = new RegionManager(_regionFactoryMock.Object);

            OnSetUp();
        }
        protected virtual IEnumerable<object> BaseGetCandidatesFromRegion(IRegion region, string candidateNavigationContract)
        {
            if (region == null) {
                throw new ArgumentNullException("region");
            }

            return region.Views.Where(v =>
                string.Equals(v.GetType().Name, candidateNavigationContract, StringComparison.Ordinal) ||
                string.Equals(v.GetType().FullName, candidateNavigationContract, StringComparison.Ordinal));
        }
 public ActionControllerViewModel(IUnityContainer container, IRegionManager regionManager, ILoggerFacade logger)
 {
     this._container = container;
     this._regionManager = regionManager;
     this._demoShowRegion = _regionManager.Regions[RegionNames.NavDemoShowRegion];
     this.logger = logger;
     this.Previous = new DelegateCommand(ToPrevious);
     this.Next = new DelegateCommand(ToNext);
     this.SwitchView = new DelegateCommand<string>(ToSpecifiedView);
 }
		void InjectViewIntoRegion( DependencyObject view, IRegion region ) 
		{
			if ( region is IContentRegion )
			{
				( ( IContentRegion )region ).Content = view;
			}
			else if ( region is IElementsRegion )
			{
				( ( IElementsRegion )region ).Add( view );
			}
		}
        public virtual MvcHtmlString RenderRegion(IRegion region, HtmlHelper helper, int containerSize = 0, List<string> excludedItems = null)
        {
            Log.Warn("IRenderer.RenderRegion({0}) is used but deprecated in DXA 1.1. Use @Html.DxaRegion instead.", region);

            if (region == null || (excludedItems != null && excludedItems.Contains(region.Name)))
            {
                return MvcHtmlString.Empty;
            }

            return helper.DxaRegion((RegionModel)region, containerSize);
        }
        protected override System.Collections.Generic.IEnumerable <object> GetCandidatesFromRegion(IRegion region, string candidateNavigationContract)
        {
            var candidates = base.GetCandidatesFromRegion(region, candidateNavigationContract).ToList();

            if (!candidates.Any())
            {
                candidates.AddRange(region.Views.Select(v => new { v, ea = v.GetType().GetCustomAttributes(true).OfType <ExportAttribute>().FirstOrDefault() }).Where(t => t.ea != null).Where(t => t.ea.ContractName == candidateNavigationContract).Select(t => t.v));
            }
            return(candidates);
        }
Example #32
0
 private IEnumerable <object> GetCandidatesFromRegionViews(IRegion region, string candidateNavigationContract)
 {
     return(region.Views.Where(v => ViewIsMatch(v.GetType(), candidateNavigationContract)));
 }
Example #33
0
 public MethodConfig(IMethodImpl methodImpl, MethodDef methodDef, MethodType type, DocumentConfig documentConfig, IRegion region = null) :
     this(methodImpl, methodDef, type, documentConfig, region, false)
 {
 }
 /// <summary>
 /// Adapts a <see cref="ContentControl"/> to an <see cref="IRegion"/>.
 /// </summary>
 /// <param name="region">The new region being used.</param>
 /// <param name="regionTarget">The object to adapt.</param>
 protected override void Adapt(IRegion region, ItemsControl regionTarget)
 {
     Adapt(regionTarget);
     base.Adapt(region, regionTarget);
 }
 private void GetComponentPresentationsFromRegion(ref List <TcmComponentPresentation> cps, IRegion region)
 {
     cps.AddRange(region.ComponentPresentations.ToList());
     foreach (IRegion nestedRegion in region.Regions)
     {
         GetComponentPresentationsFromRegion(ref cps, nestedRegion);
     }
 }
 public bool Highlight(IRegion region)
 {
     return(RunDotCommand("highlight", region, null, 0));
 }
 public bool DragDrop(IRegion fromRegion, IRegion toRegion)
 {
     return(RunCommand("dragDrop", fromRegion, toRegion, 0));
 }
 public bool RightClick(IRegion region)
 {
     return(RunCommand("rightClick", region, 0));
 }
 public bool Hover(IRegion region)
 {
     return(RunCommand("hover", region, 0));
 }
Example #40
0
 /// <summary>
 /// Template method to attach new behaviors.
 /// </summary>
 /// <param name="region">The region being used.</param>
 /// <param name="regionTarget">The object to adapt.</param>
 protected virtual void AttachBehaviors(IRegion region, T regionTarget)
 {
 }
        //IRegion Commands

        public bool Click(IRegion region)
        {
            return(RunCommand("click", region, 0));
        }
Example #42
0
        static void Main(string[] args)
        {
            try
            {
                // Create a Geode Cache.
                Apache.Geode.Client.CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();

                Cache cache = cacheFactory.Set("cache-xml-file", "XMLs/clientHACache.xml")
                              .AddServer("localhost", 40404)
                              .AddServer("localhost", 40405)
                              .SetSubscriptionRedundancy(1)
                              .SetSubscriptionEnabled(true)
                              .Create();

                Console.WriteLine("Created the Geode Cache");

                // Get the example Region from the Cache which is declared in the Cache XML file.
                IRegion <object, int> region = cache.GetRegion <object, int>("/exampleRegion");

                Console.WriteLine("Obtained the generic Region from the Cache");

                // Register and Unregister Interest on Region for Some Keys.
                object [] keys = new object[] { 123, "Key-123" };
                region.GetSubscriptionService().RegisterKeys(keys);
                region.GetSubscriptionService().RegisterRegex("Keys.*");

                Console.WriteLine("Called RegisterKeys() and RegisterRegex()");

                region[123]       = 1;
                region["Key-123"] = 2;

                Console.WriteLine("Called put() on Region");

                Console.WriteLine("Waiting for updates on keys");
                Thread.Sleep(10000);

                int count = 0;

                //try to get the entries for keys destroyed by server.
                try
                {
                    int value1 = region[123];
                    Console.WriteLine("UNEXPECTED: First get should not have succeeded");
                }
                catch (KeyNotFoundException) {
                    Console.WriteLine("gfex.Message: Verified that key1 has been destroyed");
                    count++;
                }

                try
                {
                    int value2 = region["Key-123"];
                    Console.WriteLine("UNEXPECTED: Second get should not have succeeded");
                }
                catch (KeyNotFoundException)
                {
                    Console.WriteLine("gfex.Message: Verified that key2 has been destroyed");
                    count++;
                }

                if (count == 2)
                {
                    Console.WriteLine("Verified all updates");
                }
                else
                {
                    Console.WriteLine("Could not verify all updates");
                }

                region.GetSubscriptionService().UnregisterKeys(keys);
                region.GetSubscriptionService().UnregisterRegex("Keys.*");

                Console.WriteLine("Unregistered keys");

                // Close the Geode Cache.
                cache.Close();

                Console.WriteLine("Closed the Geode Cache");
            }
            // An exception should not occur
            catch (GeodeException gfex)
            {
                Console.WriteLine("HACache Geode Exception: {0}", gfex.Message);
            }
        }
Example #43
0
 public void SetAllPoints(IRegion frame)
 {
     //throw new System.NotImplementedException();
 }
        public bool Highlight(IRegion region, string color)
        {
            string paramString = String.Format("'{0}'", color);

            return(RunDotCommand("highlight", region, paramString, 0));
        }
 public void DoPut()
 {
     region = CacheHelper.GetRegion <object, object>(RegionName);
     region[keys.ToString()] = value;
 }
        public bool Highlight(IRegion region, double seconds)
        {
            string paramString = seconds.ToString("0.####", InvariantCulture);

            return(RunDotCommand("highlight", region, paramString, 0));
        }
Example #47
0
 public void MoveFrom(IRegion sourceRegion, object view, string viewName)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// Adapts an <see cref="Selector"/> to an <see cref="IRegion"/>.
 /// </summary>
 /// <param name="region">The new region being used.</param>
 /// <param name="regionTarget">The object to adapt.</param>
 protected override void Adapt(IRegion region, Selector regionTarget)
 {
 }
Example #49
0
        static void Main(string[] args)
        {
            try
            {
                // Create a Geode Cache Programmatically.
                CacheFactory cacheFactory = CacheFactory.CreateCacheFactory();
                Cache        cache        = cacheFactory.SetSubscriptionEnabled(true).Create();

                Console.WriteLine("Created the Geode Cache");

                RegionFactory regionFactory = cache.CreateRegionFactory(RegionShortcut.CACHING_PROXY);

                // Create the example Region programmatically.
                IRegion <string, Portfolio> region = regionFactory.Create <string, Portfolio>("Portfolios");

                Console.WriteLine("Created the Region Programmatically.");

                // Register our Serializable/Cacheable Query objects, viz. Portfolio and Position.
                Serializable.RegisterTypeGeneric(Portfolio.CreateDeserializable);
                Serializable.RegisterTypeGeneric(Position.CreateDeserializable);

                Console.WriteLine("Registered Serializable Query Objects");

                // Populate the Region with some Portfolio objects.
                Portfolio port1 = new Portfolio(1 /*ID*/, 10 /*size*/);
                Portfolio port2 = new Portfolio(2 /*ID*/, 20 /*size*/);
                Portfolio port3 = new Portfolio(3 /*ID*/, 30 /*size*/);
                region["Key1"] = port1;
                region["Key2"] = port2;
                region["Key3"] = port3;

                Console.WriteLine("Populated some Portfolio Objects");

                // Get the QueryService from the Cache.
                QueryService <string, Portfolio> qrySvc = cache.GetQueryService <string, Portfolio>();

                Console.WriteLine("Got the QueryService from the Cache");

                // Execute a Query which returns a ResultSet.
                Query <Portfolio>          qry     = qrySvc.NewQuery("SELECT DISTINCT * FROM /Portfolios");
                ISelectResults <Portfolio> results = qry.Execute();

                Console.WriteLine("ResultSet Query returned {0} rows", results.Size);

                // Execute a Query which returns a StructSet.
                QueryService <string, Struct> qrySvc1 = cache.GetQueryService <string, Struct>();
                Query <Struct>          qry1          = qrySvc1.NewQuery("SELECT DISTINCT ID, status FROM /Portfolios WHERE ID > 1");
                ISelectResults <Struct> results1      = qry1.Execute();

                Console.WriteLine("StructSet Query returned {0} rows", results1.Size);

                // Iterate through the rows of the query result.
                int rowCount = 0;
                foreach (Struct si in results1)
                {
                    rowCount++;
                    Console.WriteLine("Row {0} Column 1 is named {1}, value is {2}", rowCount, si.Set.GetFieldName(0), si[0].ToString());
                    Console.WriteLine("Row {0} Column 2 is named {1}, value is {2}", rowCount, si.Set.GetFieldName(0), si[1].ToString());
                }

                // Execute a Region Shortcut Query (convenience method).
                results = region.Query <Portfolio>("ID = 2");

                Console.WriteLine("Region Query returned {0} rows", results.Size);

                // Execute the Region selectValue() API.
                object result = region.SelectValue("ID = 3");

                Console.WriteLine("Region selectValue() returned an item:\n {0}", result.ToString());

                // Execute the Region existsValue() API.
                bool existsValue = region.ExistsValue("ID = 4");

                Console.WriteLine("Region existsValue() returned {0}", existsValue ? "true" : "false");

                //Execute the parameterized query
                //Populate the parameter list (paramList) for the query.
                //TODO:remove once query service is generic
                QueryService <string, Struct> pqrySvc = cache.GetQueryService <string, Struct>();

                Query <Struct> pquery = pqrySvc.NewQuery("SELECT DISTINCT ID, status FROM /Portfolios WHERE ID > $1 and status=$2");

                object[] paramList = new object[2];
                paramList[0] = 1;        //param-1
                paramList[1] = "active"; //param-2

                ISelectResults <Struct> pqresults = pquery.Execute(paramList);

                Console.WriteLine("Parameterized Query returned {0} rows", pqresults.Size);

                // Iterate through the rows of the query result.
                rowCount = 0;
                foreach (Struct st in pqresults)
                {
                    rowCount++;
                    Console.WriteLine("Row {0} Column 1 is named {1}, value is {2}", rowCount, st.Set.GetFieldName(0), st[0].ToString());
                    Console.WriteLine("Row {0} Column 2 is named {1}, value is {2}", rowCount, st.Set.GetFieldName(0), st[1].ToString());
                }

                // Close the Geode Cache.
                cache.Close();

                Console.WriteLine("Closed the Geode Cache");
            }
            // An exception should not occur
            catch (GeodeException gfex)
            {
                Console.WriteLine("RemoteQuery Geode Exception: {0}", gfex.Message);
            }
        }
Example #50
0
 /// <summary>
 /// Adds the view to the region.
 /// </summary>
 /// <param name="region">The region to add the view to</param>
 /// <param name="view">The view to add to the region</param>
 protected virtual void AddViewToRegion(IRegion region, object view)
 {
     region.Add(view);
 }
Example #51
0
        /*
         * public void StepOneFailover()
         * {
         * // This is here so that Client1 registers information of the cacheserver
         * // that has been already started
         * CacheHelper.SetupJavaServers("remotequery.xml",
         *  "cqqueryfailover.xml");
         * CacheHelper.StartJavaServer(1, "GFECS1");
         * Util.Log("Cacheserver 1 started.");
         *
         * CacheHelper.CreateTCRegion(QueryRegionNames[0], true, true, null, true);
         *
         * Region region = CacheHelper.GetVerifyRegion(QueryRegionNames[0]);
         * Portfolio p1 = new Portfolio(1, 100);
         * Portfolio p2 = new Portfolio(2, 200);
         * Portfolio p3 = new Portfolio(3, 300);
         * Portfolio p4 = new Portfolio(4, 400);
         *
         * region.Put("1", p1);
         * region.Put("2", p2);
         * region.Put("3", p3);
         * region.Put("4", p4);
         * }
         */
        /*
         * public void StepTwoFailover()
         * {
         * CacheHelper.StartJavaServer(2, "GFECS2");
         * Util.Log("Cacheserver 2 started.");
         *
         * IAsyncResult killRes = null;
         * KillServerDelegate ksd = new KillServerDelegate(KillServer);
         * CacheHelper.CreateTCRegion(QueryRegionNames[0], true, true, null, true);
         *
         * IRegion<object, object> region = CacheHelper.GetVerifyRegion<object, object>(QueryRegionNames[0]);
         *
         * var qs = CacheHelper.DCache.GetQueryService();
         * CqAttributesFactory cqFac = new CqAttributesFactory();
         * ICqListener cqLstner = new MyCqListener();
         * cqFac.AddCqListener(cqLstner);
         * CqAttributes cqAttr = cqFac.Create();
         * CqQuery qry = qs.NewCq(CqName1, "select * from /" + QERegionName + "  p where p.ID!<4", cqAttr, true);
         * qry.Execute();
         * Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
         * qry = qs.GetCq(CqName1);
         * cqAttr = qry.GetCqAttributes();
         * ICqListener[] vl = cqAttr.getCqListeners();
         * Assert.IsNotNull(vl);
         * Assert.AreEqual(1, vl.Length);
         * cqLstner = vl[0];
         * Assert.IsNotNull(cqLstner);
         * MyCqListener myLisner = cqLstner as MyCqListener;
         * if (myLisner.getEventCountAfter() + myLisner.getErrorCountAfter() != 0)
         * {
         *  Assert.Fail("cq after count not zero");
         * }
         *
         * killRes = ksd.BeginInvoke(null, null);
         * Thread.Sleep(18000); // sleep 0.3min to allow failover complete
         * myLisner.failedOver();
         *
         * Portfolio p1 = new Portfolio(1, 100);
         * Portfolio p2 = new Portfolio(2, 200);
         * Portfolio p3 = new Portfolio(3, 300);
         * Portfolio p4 = new Portfolio(4, 400);
         *
         * region.Put("4", p1);
         * region.Put("3", p2);
         * region.Put("2", p3);
         * region.Put("1", p4);
         * Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
         *
         * qry = qs.GetCq(CqName1);
         * cqAttr = qry.GetCqAttributes();
         * vl = cqAttr.getCqListeners();
         * cqLstner = vl[0];
         * Assert.IsNotNull(vl);
         * Assert.AreEqual(1, vl.Length);
         * cqLstner = vl[0];
         * Assert.IsNotNull(cqLstner);
         * myLisner = cqLstner as MyCqListener;
         * if (myLisner.getEventCountAfter() + myLisner.getErrorCountAfter() == 0)
         * {
         *  Assert.Fail("no cq after failover");
         * }
         *
         * killRes.AsyncWaitHandle.WaitOne();
         * ksd.EndInvoke(killRes);
         * qry.Stop();
         * qry.Close();
         * }
         */

        public void ProcessCQ(string locators)
        {
            CacheHelper.CreateTCRegion_Pool <object, object>(QERegionName, true, true,
                                                             null, locators, "__TESTPOOL1_", true);

            IRegion <object, object> region = CacheHelper.GetVerifyRegion <object, object>(QERegionName);
            Portfolio p1 = new Portfolio(1, 100);
            Portfolio p2 = new Portfolio(2, 100);
            Portfolio p3 = new Portfolio(3, 100);
            Portfolio p4 = new Portfolio(4, 100);

            region["1"] = p1;
            region["2"] = p2;
            region["3"] = p3;
            region["4"] = p4;

            var qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService();

            CqAttributesFactory <object, object> cqFac          = new CqAttributesFactory <object, object>();
            ICqListener <object, object>         cqLstner       = new MyCqListener <object, object>();
            ICqStatusListener <object, object>   cqStatusLstner = new MyCqStatusListener <object, object>(1);

            ICqListener <object, object>[] v = new ICqListener <object, object> [2];
            cqFac.AddCqListener(cqLstner);
            v[0] = cqLstner;
            v[1] = cqStatusLstner;
            cqFac.InitCqListeners(v);
            Util.Log("InitCqListeners called");
            CqAttributes <object, object> cqAttr = cqFac.Create();
            CqQuery <object, object>      qry1   = qs.NewCq("CQ1", "select * from /" + QERegionName + "  p where p.ID >= 1", cqAttr, false);

            qry1.Execute();

            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
            region["4"] = p1;
            region["3"] = p2;
            region["2"] = p3;
            region["1"] = p4;
            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete

            qry1   = qs.GetCq <object, object>("CQ1");
            cqAttr = qry1.GetCqAttributes();
            ICqListener <object, object>[] vl = cqAttr.getCqListeners();
            Assert.IsNotNull(vl);
            Assert.AreEqual(2, vl.Length);
            cqLstner = vl[0];
            Assert.IsNotNull(cqLstner);
            MyCqListener <object, object> myLisner = (MyCqListener <object, object>)cqLstner;// as MyCqListener<object, object>;

            Util.Log("event count:{0}, error count {1}.", myLisner.getEventCountBefore(), myLisner.getErrorCountBefore());
            Assert.AreEqual(4, myLisner.getEventCountBefore());

            cqStatusLstner = (ICqStatusListener <object, object>)vl[1];
            Assert.IsNotNull(cqStatusLstner);
            MyCqStatusListener <object, object> myStatLisner = (MyCqStatusListener <object, object>)cqStatusLstner;// as MyCqStatusListener<object, object>;

            Util.Log("event count:{0}, error count {1}.", myStatLisner.getEventCountBefore(), myStatLisner.getErrorCountBefore());
            Assert.AreEqual(1, myStatLisner.getCqConnectedCount());
            Assert.AreEqual(4, myStatLisner.getEventCountBefore());

            CqAttributesMutator <object, object> mutator = qry1.GetCqAttributesMutator();

            mutator.RemoveCqListener(cqLstner);
            cqAttr = qry1.GetCqAttributes();
            Util.Log("cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
            Assert.AreEqual(1, cqAttr.getCqListeners().Length);

            mutator.RemoveCqListener(cqStatusLstner);
            cqAttr = qry1.GetCqAttributes();
            Util.Log("1 cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
            Assert.AreEqual(0, cqAttr.getCqListeners().Length);

            ICqListener <object, object>[] v2 = new ICqListener <object, object> [2];
            v2[0] = cqLstner;
            v2[1] = cqStatusLstner;
            MyCqListener <object, object> myLisner2 = (MyCqListener <object, object>)cqLstner;

            myLisner2.Clear();
            MyCqStatusListener <object, object> myStatLisner2 = (MyCqStatusListener <object, object>)cqStatusLstner;

            myStatLisner2.Clear();
            mutator.SetCqListeners(v2);
            cqAttr = qry1.GetCqAttributes();
            Assert.AreEqual(2, cqAttr.getCqListeners().Length);

            region["4"] = p1;
            region["3"] = p2;
            region["2"] = p3;
            region["1"] = p4;
            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete

            qry1   = qs.GetCq <object, object>("CQ1");
            cqAttr = qry1.GetCqAttributes();
            ICqListener <object, object>[] v3 = cqAttr.getCqListeners();
            Assert.IsNotNull(v3);
            Assert.AreEqual(2, vl.Length);
            cqLstner = v3[0];
            Assert.IsNotNull(cqLstner);
            myLisner2 = (MyCqListener <object, object>)cqLstner;// as MyCqListener<object, object>;
            Util.Log("event count:{0}, error count {1}.", myLisner2.getEventCountBefore(), myLisner2.getErrorCountBefore());
            Assert.AreEqual(4, myLisner2.getEventCountBefore());

            cqStatusLstner = (ICqStatusListener <object, object>)v3[1];
            Assert.IsNotNull(cqStatusLstner);
            myStatLisner2 = (MyCqStatusListener <object, object>)cqStatusLstner;// as MyCqStatusListener<object, object>;
            Util.Log("event count:{0}, error count {1}.", myStatLisner2.getEventCountBefore(), myStatLisner2.getErrorCountBefore());
            Assert.AreEqual(0, myStatLisner2.getCqConnectedCount());
            Assert.AreEqual(4, myStatLisner2.getEventCountBefore());

            mutator = qry1.GetCqAttributesMutator();
            mutator.RemoveCqListener(cqLstner);
            cqAttr = qry1.GetCqAttributes();
            Util.Log("cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
            Assert.AreEqual(1, cqAttr.getCqListeners().Length);

            mutator.RemoveCqListener(cqStatusLstner);
            cqAttr = qry1.GetCqAttributes();
            Util.Log("1 cqAttr.getCqListeners().Length = {0}", cqAttr.getCqListeners().Length);
            Assert.AreEqual(0, cqAttr.getCqListeners().Length);

            region["4"] = p1;
            region["3"] = p2;
            region["2"] = p3;
            region["1"] = p4;
            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete

            qry1   = qs.GetCq <object, object>("CQ1");
            cqAttr = qry1.GetCqAttributes();
            ICqListener <object, object>[] v4 = cqAttr.getCqListeners();
            Assert.IsNotNull(v4);
            Assert.AreEqual(0, v4.Length);
            Util.Log("cqAttr.getCqListeners() done");
        }
Example #52
0
        protected override void InitViews()
        {
            IRegion workspaceRegion = GetWorkspaceRegion();

            workspaceRegion.Add(container.Resolve <ListeningsView>(), WorkspaceNameEnum.Listenings.ToString());
        }
Example #53
0
        public void StepOnePdxQE(string locators)
        {
            CacheHelper.CreateTCRegion_Pool <object, object>(QERegionName, true, true,
                                                             null, locators, "__TESTPOOL1_", true);
            IRegion <object, object> region = CacheHelper.GetVerifyRegion <object, object>(QERegionName);
            PortfolioPdx             p1     = new PortfolioPdx(1, 100);
            PortfolioPdx             p2     = new PortfolioPdx(2, 100);
            PortfolioPdx             p3     = new PortfolioPdx(3, 100);
            PortfolioPdx             p4     = new PortfolioPdx(4, 100);

            region["1"] = p1;
            region["2"] = p2;
            region["3"] = p3;
            region["4"] = p4;

            var qs = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_").GetQueryService();
            CqAttributesFactory <object, object> cqFac    = new CqAttributesFactory <object, object>();
            ICqListener <object, object>         cqLstner = new MyCqListener <object, object>();

            cqFac.AddCqListener(cqLstner);
            CqAttributes <object, object> cqAttr = cqFac.Create();
            CqQuery <object, object>      qry    = qs.NewCq(CqName, "select * from /" + QERegionName + "  p where p.ID!=2", cqAttr, false);

            qry.Execute();
            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete
            region["4"] = p1;
            region["3"] = p2;
            region["2"] = p3;
            region["1"] = p4;
            Thread.Sleep(18000); // sleep 0.3min to allow server c query to complete

            qry = qs.GetCq <object, object>(CqName);

            CqServiceStatistics cqSvcStats = qs.GetCqStatistics();

            Assert.AreEqual(1, cqSvcStats.numCqsActive());
            Assert.AreEqual(1, cqSvcStats.numCqsCreated());
            Assert.AreEqual(1, cqSvcStats.numCqsOnClient());

            cqAttr = qry.GetCqAttributes();
            ICqListener <object, object>[] vl = cqAttr.getCqListeners();
            Assert.IsNotNull(vl);
            Assert.AreEqual(1, vl.Length);
            cqLstner = vl[0];
            Assert.IsNotNull(cqLstner);
            MyCqListener <object, object> myLisner = (MyCqListener <object, object>)cqLstner;// as MyCqListener<object, object>;

            Util.Log("event count:{0}, error count {1}.", myLisner.getEventCountBefore(), myLisner.getErrorCountBefore());

            CqStatistics cqStats = qry.GetStatistics();

            Assert.AreEqual(cqStats.numEvents(), myLisner.getEventCountBefore());
            if (myLisner.getEventCountBefore() + myLisner.getErrorCountBefore() == 0)
            {
                Assert.Fail("cq before count zero");
            }
            qry.Stop();
            Assert.AreEqual(1, cqSvcStats.numCqsStopped());
            qry.Close();
            Assert.AreEqual(1, cqSvcStats.numCqsClosed());
            // Bring down the region
            region.GetLocalView().DestroyRegion();
        }
Example #54
0
        private MethodConfig(IMethodImpl methodImpl, MethodDef methodDef, MethodType type, DocumentConfig documentConfig, IRegion region, bool isTokenOverload)
        {
            Method     = methodImpl;
            MethodDef  = methodDef;
            MethodType = type;

            if (region != null && region.Type != MethodType.Unspecified)
            {
                MethodType = region.Type;
            }

            DocumentConfig = documentConfig;
            this.region    = region;

            CalculateCancellationTokenMode(isTokenOverload);
        }
        public bool Highlight(IRegion region, double seconds, string color)
        {
            string paramString = String.Format("{0}, '{1}'", seconds.ToString("0.####", InvariantCulture), color);

            return(RunDotCommand("highlight", region, paramString, 0));
        }
Example #56
0
 public void Add(IRegion region)
 {
     regions[region.Name] = region;
 }
Example #57
0
 protected override void Adapt(IRegion region, MockRegionTarget regionTarget)
 {
     AdaptArgumentRegion       = region;
     adaptArgumentRegionTarget = regionTarget;
 }
Example #58
0
 protected override void AttachBehaviors(IRegion region, MockRegionTarget regionTarget)
 {
     AttachBehaviorsArgumentRegion        = region;
     attachBehaviorsArgumentTargetToAdapt = regionTarget;
     base.AttachBehaviors(region, regionTarget);
 }
 public bool DoubleClick(IRegion region)
 {
     return(RunCommand("doubleClick", region, 0));
 }
Example #60
0
 /// <summary>
 /// Template method to adapt the object to an <see cref="IRegion"/>.
 /// </summary>
 /// <param name="region">The new region being used.</param>
 /// <param name="regionTarget">The object to adapt.</param>
 protected abstract void Adapt(IRegion region, T regionTarget);