예제 #1
0
        /// <summary>
        /// Register session within the module. Module can optionaly create a remotable object associated with the session.
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        protected internal override Remoting.IDextopRemotable RegisterSession(DextopSession session)
        {
            var config = new DextopConfig();

            config.Add("url", DextopUtil.AbsolutePath(DextopUtil.CombinePaths(base.VirtualPath, "soundmanager2/swf")));
            if (sounds != null)
            {
                config.Add("sounds", sounds);
            }
            return(new DextopRemotableConfig("Dextop.modules.SoundModule", config));
        }
예제 #2
0
 /// <summary>
 /// Register session within the module. Module can optionaly create a remotable object associated with the session.
 /// </summary>
 /// <param name="session"></param>
 /// <returns></returns>
 protected internal override Remoting.IDextopRemotable RegisterSession(DextopSession session)
 {
     var config = new DextopConfig();
     config.Add("url", DextopUtil.AbsolutePath(DextopUtil.CombinePaths(base.VirtualPath, "soundmanager2/swf")));
     if (sounds != null)
         config.Add("sounds", sounds);
     return new DextopRemotableConfig("Dextop.modules.SoundModule", config);
 }
예제 #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 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);
		}
예제 #4
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;
            }

        }
예제 #5
0
		public override void InitRemotable(DextopRemote remote, DextopConfig config)
		{
			base.InitRemotable(remote, config);
			config.Add("soundUrl", DextopUtil.AbsolutePath("client/sound/notify.mp3"));
		}
예제 #6
0
 public override void InitRemotable(DextopRemote remote, DextopConfig config)
 {
     base.InitRemotable(remote, config);
     config.Add("soundUrl", DextopUtil.AbsolutePath("client/sound/notify.mp3"));
 }