コード例 #1
0
        public ProductBrowser()
        {
            InitializeComponent();
            Serializable.RegisterType(Product.CreateInstance);

            /*
             * Initialize Cache system properties
             */
            Apache.Geode.Client.Properties prop = Apache.Geode.Client.Properties.Create();
            prop.Insert("log-file", logFile);
            prop.Insert("log-level", logLevel);
            prop.Insert("name", "ProductCache");
            CacheFactory cacheFactory = CacheFactory.CreateCacheFactory(prop);

            try
            {
                /*
                 * Create the GemFire Client cache
                 */

                Cache cache = cacheFactory.SetSubscriptionEnabled(true).Create();

                /*
                 * Specify required region attributes
                 */

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

                /*
                 * Create the region and register interest in all keys
                 */
                prodRegion = regionFactory
                             .SetCachingEnabled(true)
                             .SetCacheListener(this)
                             .Create("product");

                prodRegion.RegisterAllKeys();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error during client initialization.  " + e.Message);
            }
        }
コード例 #2
0
 public void AfterRegionDisconnected(Apache.Geode.Client.Region region)
 {
     txtEvent.Text = region.Name + " has disconnected";
 }
コード例 #3
0
 public void Close(Apache.Geode.Client.Region region)
 {
     txtEvent.Text = region.Name + " has closed";
 }