Exemplo n.º 1
0
 /// <summary>
 /// Static ctor
 /// Registers all DiPSControllers
 /// </summary>
 public static void InitializeBackEnd(bool initializeServer = true)
 {
     if (initializeServer)
         InitializeDiPS();
     Client = new DiPSClient(ConfigurationManager.AppSettings["dipsserver"]);
     RegisterAllControllers();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Static ctor
 /// Registers all DiPSControllers
 /// </summary>
 public static void InitializeBackEnd(string dipsConnectionString, bool initializeServer = true)
 {
     if (initializeServer)
         InitializeDiPS();
     Client = new DiPSClient(dipsConnectionString);
     RegisterAllControllers();
 }
        /// <summary>
        /// Ctor, we need the client to subscribe all the events in here
        /// </summary>
        public DiPSController(DiPSClient client)
        {
            DiPSClient = client;
            var myType = this.GetType();
            //get all the methods
            var methods = myType.GetMethods();
            foreach (var m in methods)
            {
                //register only public methods
                if (!m.IsPublic)
                    continue;

                client.Subscribe(myType.Name + "." + m.Name, (param) =>
                {
                    try
                    {
                        var pars = new List<object>();
                        pars.Add(param);
                        m.Invoke(this, pars.ToArray());
                    }
                    catch (Exception e)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(e);
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                });
            }
        }
 /// <summary>
 /// Subscribe to the events
 /// </summary>
 public UserController(DiPSClient client)
 {
     Client = client;
     Client.Subscribe("login", (u) =>
     {
         Login(u.UserName.ToString());
     });
 }
        public static void Initialize(string url)
        {
            if (!IsInitialized)
            {
                IsInitialized = true;
                client = new DiPSClient(url);

            }
        }
        /// <summary>
        /// Ctor:
        /// Subscribe to the Events
        /// </summary>
        public TaskController(DiPSClient client)
        {
            Client = client;
            Client.Subscribe("GetTasks", (t) =>
            {
                GetTasks(Guid.Parse(t.UserId.ToString()));
            });

            Client.Subscribe("InsertTask", (t) =>
            {
                InsertTask(new Task {  Completed = t.Completed, OwnerId = t.OwnerId, Description = t.Description, ViewOrder = t.Order });
            });

            Client.Subscribe("DeleteTask", (t) =>
            {
                DeleteTask(Guid.Parse(t.Id.ToString()));
            });

            Client.Subscribe("UpdateTask", (t) =>
            {
                UpdateTask(new Task { Id = t.Id, Completed = t.Completed, OwnerId = t.OwnerId, Description = t.Description });
            });
        }
Exemplo n.º 7
0
 public Test(DiPSClient client)
     : base(client)
 {
 }