Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the remotable object.
        /// </summary>
        /// <param name="remote">Remote object used for communication with the client-side object.</param>
        /// <param name="config">Configuration of the object to be created on the client side.</param>
        public virtual void InitRemotable(DextopRemote remote, DextopConfig config)
        {
            Remote = remote;
            config.Add("direct", GetDirectConfig());

            var appPath = DextopEnvironment.VirtualAppPath;

            if (!appPath.EndsWith("/"))
            {
                appPath += "/";
            }

            config.Add("virtualAppPath", appPath);

            DextopConfig modules = new DextopConfig();

            foreach (var m in DextopApplication.GetModules())
            {
                var r = m.RegisterSession(this);
                if (r != null)
                {
                    modules.Add(m.ModuleName, Remote.TrackRemotableComponent(r));
                }
            }
            if (modules.Count > 0)
            {
                config.Add("modules", modules);
            }
        }
Ejemplo n.º 2
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     var crud = new DextopMemoryDataProxy<Model, int>(a => a.Id, (lastId) => { return ++lastId; }) {
          Paging = true
     };
     Remote.AddStore("model", crud);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the remotable object.
        /// </summary>
        /// <param name="remote">Remote object used for communication with the client-side object.</param>
        /// <param name="config">Configuration of the object to be created on the client side.</param>
        public void InitRemotable(DextopRemote remote, DextopConfig config)
        {
            Remote = remote;
            if (Config != null)
            {
                config.Apply(Config);
                Config = null;
            }

            remote.RemoteHostType = RemoteHostType;
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Initializes the remotable object.
		/// </summary>
		/// <param name="remote">Remote object used for communication with the client-side object.</param>
		/// <param name="config">Configuration of the object to be created on the client side.</param>
		public void InitRemotable(DextopRemote remote, DextopConfig config)
		{
			Remote = remote;
			if (Config != null)
			{
				config.Apply(Config);
				Config = null;
			}

			remote.RemoteHostType = RemoteHostType;
		}
Ejemplo n.º 5
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.OnProcessAjaxRequest = RenderReport;
     Remote.AddStore("reports", new[] {
         new ReportType { ReportId = "GdpByYear", Title = "GDP By Year" },
         new ReportType { ReportId = "GdpByCountry", Title = "GDP By Country" },
         new ReportType { ReportId = "BiggestCountries", Title = "Biggest Countries" },
         new ReportType { ReportId = "FastestGrowingCountries", Title = "Fastest Growing Countries" },
         new ReportType { ReportId = "BestCountries", Title = "Best Countries (GNI per Capita)" },
     });
 }
Ejemplo n.º 6
0
        public override void InitRemotable(DextopRemote remote, DextopConfig config)
        {
            base.InitRemotable(remote, config);
            Remote.AddStore("model", Load);
            Remote.AddStore("history", LoadHistory);
            Remote.AddLookupData("Currency", CurrencyDataProvider.GetCurrencyList().Rates.Select(a => new Object[] {
                a.ISOCode,
                String.Format("{0} ({1})", a.Currency, a.ISOCode)
            }).ToArray());

            config["convertData"] = new ConvertForm
            {
                Amount = 100,
                Currency = "EUR"
            };
        }
Ejemplo n.º 7
0
		/// <summary>
		/// Initializes the remotable object.
		/// </summary>
		/// <param name="remote">Remote object used for communication with the client-side object.</param>
		/// <param name="config">Configuration of the object to be created on the client side.</param>
		public virtual void InitRemotable(DextopRemote remote, DextopConfig config)
		{
			Remote = remote;
			config.Add("direct", GetDirectConfig());

            var appPath = DextopEnvironment.VirtualAppPath;
            if (!appPath.EndsWith("/"))
                appPath += "/";

            config.Add("virtualAppPath", appPath);

			DextopConfig modules = new DextopConfig();
			foreach (var m in DextopApplication.GetModules())
			{
				var r = m.RegisterSession(this);
				if (r != null)
					modules.Add(m.ModuleName, Remote.TrackRemotableComponent(r));
			}
			if (modules.Count > 0)
				config.Add("modules", modules);
		}
Ejemplo n.º 8
0
        internal DextopConfig Register(DextopRemote parent, IDextopRemotable remotable, String remoteId = null, bool subRemote = true)
        {
            if (remotable == null)
                throw new ArgumentNullException("remotable");

            bool isClientInitiated;

            if (remoteId == null)
            {
                remoteId = Interlocked.Increment(ref nextRemoteId).ToString();
                isClientInitiated = parent!=null && parent.IsClientInitiated;
            }
            else if (subRemote)
            {
                if (parent == null)
                    throw new DextopInternalException();
                remoteId = parent.RemoteId + '.' + remoteId;
                isClientInitiated = parent.IsClientInitiated;
            }
            else
                isClientInitiated = true;

            var context = new RemotableContext
            {
                Remotable = remotable
            };

            var remote = new DextopRemote(Context, remoteId, isClientInitiated);           

			var clientTypeName = DextopApplication.MapTypeName(remotable.GetType());

            try
            {
                var config = new DextopConfig();
                remotable.InitRemotable(remote, config);

                if (!remote.IsClientInitiated)
                {
                    DextopConfig remoteProxyConfig;
					var remoteTypeName = remote.RemoteHostType ?? clientTypeName;
                    if (remoteTypeName != null)
                    {
                        config.Add("alias", remoteTypeName);
                        remoteProxyConfig = new DextopConfig();
                        config.Add("remote", remoteProxyConfig);
                    }
                    else
                    {
                        remoteProxyConfig = config;
                    }
                    remoteProxyConfig.Add("remoteId", remoteId);
					remoteProxyConfig.Add("alias", DextopUtil.GetRemotingProxyTypeName(clientTypeName));
                    if (remote.componentsConfig != null)
                    {
                        remoteProxyConfig.Add("components", remote.componentsConfig);

                        //config not needed anymore - free memory
                        remote.componentsConfig = null;
                    }
                }

                if (!remotables.TryAdd(remoteId, context))
                    throw new DextopInternalException();

                return config;
            }
            catch
            {
                remote.Dispose();
                remotable.Dispose();
                throw;
            }

        }
Ejemplo n.º 9
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     config["appPath"] = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/');
     config["versionNumber"] = Pecunia.Services.AssemblyService.GetVersionNumber();
 }
Ejemplo n.º 10
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.AddStore("model", Load);
 }
Ejemplo n.º 11
0
        internal DextopConfig Register(DextopRemote parent, IDextopRemotable remotable, String remoteId = null, bool subRemote = true)
        {
            if (remotable == null)
            {
                throw new ArgumentNullException("remotable");
            }

            bool isClientInitiated;

            if (remoteId == null)
            {
                remoteId          = Interlocked.Increment(ref nextRemoteId).ToString();
                isClientInitiated = parent != null && parent.IsClientInitiated;
            }
            else if (subRemote)
            {
                if (parent == null)
                {
                    throw new DextopInternalException();
                }
                remoteId          = parent.RemoteId + '.' + remoteId;
                isClientInitiated = parent.IsClientInitiated;
            }
            else
            {
                isClientInitiated = true;
            }

            var context = new RemotableContext
            {
                Remotable = remotable
            };

            var remote = new DextopRemote(Context, remoteId, isClientInitiated);

            var clientTypeName = DextopApplication.MapTypeName(remotable.GetType());

            try
            {
                var config = new DextopConfig();
                remotable.InitRemotable(remote, config);

                if (!remote.IsClientInitiated)
                {
                    DextopConfig remoteProxyConfig;
                    var          remoteTypeName = remote.RemoteHostType ?? clientTypeName;
                    if (remoteTypeName != null)
                    {
                        config.Add("alias", remoteTypeName);
                        remoteProxyConfig = new DextopConfig();
                        config.Add("remote", remoteProxyConfig);
                    }
                    else
                    {
                        remoteProxyConfig = config;
                    }
                    remoteProxyConfig.Add("remoteId", remoteId);
                    remoteProxyConfig.Add("alias", DextopUtil.GetRemotingProxyTypeName(clientTypeName));
                    if (remote.componentsConfig != null)
                    {
                        remoteProxyConfig.Add("components", remote.componentsConfig);

                        //config not needed anymore - free memory
                        remote.componentsConfig = null;
                    }
                }

                if (!remotables.TryAdd(remoteId, context))
                {
                    throw new DextopInternalException();
                }

                return(config);
            }
            catch
            {
                remote.Dispose();
                remotable.Dispose();
                throw;
            }
        }
Ejemplo n.º 12
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
 }
Ejemplo n.º 13
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.AddStore("model", new Codaxy.Dextop.Data.DextopMemoryDataProxy<User, int>(a=>a.Id, (id) => { return ++id; }));
 }
Ejemplo n.º 14
0
		/// <summary>
		/// Initializes the remotable object.
		/// </summary>
		/// <param name="remote">Remote object used for communication with the client-side object.</param>
		/// <param name="config">Configuration of the object to be created on the client side.</param>
		public virtual void InitRemotable(DextopRemote remote, DextopConfig config)
		{
			Remote = remote;
		}
Ejemplo n.º 15
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     config["appPath"] = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/');
 }
Ejemplo n.º 16
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.OnProcessAjaxRequest = ProcessAjaxRequest;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Initializes the remotable object.
 /// </summary>
 /// <param name="remote">Remote object used for communication with the client-side object.</param>
 /// <param name="config">Configuration of the object to be created on the client side.</param>
 public virtual void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     Remote = remote;
 }
Ejemplo n.º 18
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.RemoteHostType = "Codaxy.Dox.SimpleWindow";
 }