コード例 #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);
            }
        }
コード例 #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);
 }
コード例 #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;
        }
コード例 #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;
		}
コード例 #5
0
ファイル: GdpPanel.cs プロジェクト: borisdj/dextop-pecunia
 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)" },
     });
 }
コード例 #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"
            };
        }
コード例 #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);
		}
コード例 #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;
            }

        }
コード例 #9
0
ファイル: Session.cs プロジェクト: codaxy/dextop-pecunia
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     config["appPath"] = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/');
     config["versionNumber"] = Pecunia.Services.AssemblyService.GetVersionNumber();
 }
コード例 #10
0
ファイル: StocksPanel.cs プロジェクト: borisdj/dextop-pecunia
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.AddStore("model", Load);
 }
コード例 #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;
            }
        }
コード例 #12
0
ファイル: Session.cs プロジェクト: codaxy/dox
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
 }
コード例 #13
0
ファイル: UsersPanel.cs プロジェクト: borisdj/dextop-pecunia
 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; }));
 }
コード例 #14
0
ファイル: DextopRemotableBase.cs プロジェクト: borisdj/dextop
		/// <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;
		}
コード例 #15
0
ファイル: Session.cs プロジェクト: borisdj/dextop-pecunia
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     config["appPath"] = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/');
 }
コード例 #16
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.OnProcessAjaxRequest = ProcessAjaxRequest;
 }
コード例 #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;
 }
コード例 #18
0
ファイル: SimpleWindow.cs プロジェクト: codaxy/dox
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     Remote.RemoteHostType = "Codaxy.Dox.SimpleWindow";
 }