Beispiel #1
0
        public static IBinding <TView, TContext> TwoWay(
            string propertyName, Func <TContext, TValue> getContextValue, Action <TView, TValue> setViewValue,
            Action <TContext, TValue> setContextValue, Func <TView, TValue> getViewValue, EventInfo eventInfo)
        {
            var viewUpdater    = new ViewUpdater(getContextValue, setViewValue);
            var contextUpdater = new ContextUpdater(setContextValue, getViewValue, eventInfo);

            return(new Binding <TView, TContext, TValue>(propertyName, contextUpdater, viewUpdater));
        }
Beispiel #2
0
 private void ThreadSafeUpdate()
 {
     if (treeViewResults.InvokeRequired)
     {
         ViewUpdater Updater = UpdateTreeView;
         treeViewResults.Invoke(Updater);
     }
     else
     {
         UpdateTreeView();
     }
 }
Beispiel #3
0
 //<Constructors>
 public Client(ICommunication communication)
 {
     _game = new GameOutput();
     _clientDataPackageProvider = new ClientDataPackageProvider();
     _viewDictionary            = new ViewDictionary();
     _communication             = communication;
     _actionHandler             = new ProtocolAction(_viewDictionary._views, this, _clientDataPackageProvider, _game);
     _inputHandler  = new InputAction(_actionHandler, _viewDictionary._views, this, _clientDataPackageProvider);
     _outputWrapper = new OutputWrapper();
     _viewUpdater   = new ViewUpdater(_viewDictionary._views);
     _actionHandler._enterToRefreshView.ViewEnabled = true;
     _actionHandler._enterToRefreshView.SetUpdateContent("Press enter to refresh\nafter you typed a command.");
 }
        public ActionResult UpdateClient(ClientUpdateApiModel client)
        {
            try
            {
                ClientSessions.Update(client.ServerId, client.ServerName);

                ViewUpdater.Update();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }
        public ActionResult RemoveClient([FromBody] string serverId)
        {
            try
            {
                ClientSessions.Remove(serverId);

                ViewUpdater.Update();

                return(Ok());
            }

            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }
        public ActionResult RemoveClients([FromBody] GridModel <ClientUpdateApiModel, string> vm)
        {
            try
            {
                foreach (var item in vm.Deleted)
                {
                    ClientSessions.Remove(item.ServerId);
                }


                ViewUpdater.Update();

                return(Ok());
            }

            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }
        public async Task <ActionResult <string> > Push(LogViewModel data)
        {
            try
            {
                var item = populteListItem(data);
                ClientSessions.Add(item);

                ViewUpdater.Update();

                using (var client = new HttpClient())
                {
                    var response = await client.PostAsJsonAsync("http://clients.ranpod.com/api/data/push", data);

                    return(StatusCode((int)response.StatusCode, $"Server response :{await response.Content.ReadAsStringAsync()}"));
                }
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));

                throw;
            }
        }
Beispiel #8
0
        public static IBinding <TView, TContext> OneWayToView(string propertyName, Func <TContext, TValue> getContextValue, Action <TView, TValue> setViewValue)
        {
            var viewUpdater = new ViewUpdater(getContextValue, setViewValue);

            return(new Binding <TView, TContext, TValue>(propertyName, null, viewUpdater));
        }
Beispiel #9
0
 Binding(string propertyName, ContextUpdater contextUpdater, ViewUpdater viewUpdater)
 {
     this.PropertyName   = propertyName ?? throw new ArgumentNullException(propertyName);
     this.viewUpdater    = viewUpdater;
     this.contextUpdater = contextUpdater;
 }
 public Handler(NuclearStorage storage, ViewUpdater <int, CustomDomainViewWithTypedKey> view, IMessageSender sender)
 {
     _storage = storage;
     _sender  = sender;
     _view    = view;
 }