Ejemplo n.º 1
0
        static public DSProxy.TLoginUser getLoginUserInstance(DSAdmin.ExceptionCallback ManageExceptionCallback = null)
        {
            if (instance == null)
            {
                string hostname;
                string port;
                if (!settings.TryGetValue <string>("hostname", out hostname))
                {
                    hostname = "localhost";
                }

                if (!settings.TryGetValue <string>("port", out port))
                {
                    port = "8080";
                }

                DSRESTConnection connection = new DSRESTConnection();
                connection.setHost(hostname);
                connection.setPort(Convert.ToInt32(port));
                connection.setProtocol("http");
                connection.setUserName("FSAdmin");
                connection.setPassword("fs123!@#");
                if (ManageExceptionCallback == null)
                {
                    instance = new DSProxy.TLoginUser(connection, (e) => { MessageBox.Show("会话已过期,请重新登录."); });
                }
                else
                {
                    instance = new DSProxy.TLoginUser(connection, ManageExceptionCallback);
                }
            }
            return(instance);
        }
Ejemplo n.º 2
0
        static public DSProxy.TCompanyTweet getCompanyTweet(DSAdmin.ExceptionCallback ManageExceptionCallback = null)
        {
            if (instance == null)
            {
                string hostname;
                string port;
                if (!settings.TryGetValue <string>("hostname", out hostname))
                {
                    hostname = "datasnap.embarcadero.com";
                }

                if (!settings.TryGetValue <string>("port", out port))
                {
                    port = "8086";
                }

                DSRESTConnection connection = new DSRESTConnection();
                connection.setHost(hostname);
                connection.setPort(Convert.ToInt32(port));
                connection.setProtocol("http");
                if (ManageExceptionCallback == null)
                {
                    instance = new DSProxy.TCompanyTweet(connection, (e) => { MessageBox.Show("Session expired. Try to login again."); });
                }
                else
                {
                    instance = new DSProxy.TCompanyTweet(connection, ManageExceptionCallback);
                }
            }
            return(instance);
        }
 /**
  * @param Connection DSRESTConnection
  * @param ChannelName String
  * @param ManagerID String
  */
 public DSCallbackChannelManager(DSRESTConnection Connection,
         String ChannelName, String ManagerID, DSAdmin.ExceptionCallback ExceptionCallback)
     : base()
 {
     locker = new Object();
     this.ExCallback = ExceptionCallback;
     this.ChannelName = ChannelName;
     this.ManagerID = ManagerID;
     this.Connection = Connection;
     this.dsadmin = new DSAdmin(this.Connection, ExCallback);
     Random random = new Random();
     this.SecurityToken = Convert.ToString(random.Next(100000)) + "." + Convert.ToString(random.Next(100000));
 }
Ejemplo n.º 4
0
        /**
         * @param Connection DSRESTConnection
         * @param ChannelName String
         * @param ManagerID String
         */
        public DSCallbackChannelManager(DSRESTConnection Connection,
                                        String ChannelName, String ManagerID, DSAdmin.ExceptionCallback ExceptionCallback)
            : base()
        {
            locker           = new Object();
            this.ExCallback  = ExceptionCallback;
            this.ChannelName = ChannelName;
            this.ManagerID   = ManagerID;
            this.Connection  = Connection;
            this.dsadmin     = new DSAdmin(this.Connection, ExCallback);
            Random random = new Random();

            this.SecurityToken = Convert.ToString(random.Next(100000)) + "." + Convert.ToString(random.Next(100000));
        }
Ejemplo n.º 5
0
 public void BroadcastToChannel(String ChannelName, TJSONValue Msg, DSAdmin.BroadcastToChannelCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.BroadcastToChannel(ChannelName, Msg, callback, ExCal);
 }
Ejemplo n.º 6
0
 public void NotifyCallback(String ClientId, String CallbackId, TJSONValue Msg, DSAdmin.NotifyCallbackCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.NotifyCallback(ClientId, CallbackId, Msg, callback, ExCal);
 }