コード例 #1
0
        private void OnItemChanged(int id)
        {
            var item = _dataService.GetItem(id);

            if (NodesChanged != null)
            {
                NodesChanged(this, new TreeModelEventArgs(new TreePath(item), new object[] { item }));
            }
        }
コード例 #2
0
        private TcpMessage HandleUniqueItemQuery(TcpConnectedHost host, TcpMessage message)
        {
            if (!message.HasType(TcpRequestType.UniqueItemQuery))
            {
                return(null);
            }

            if (!IsAuthenticated(host))
            {
                throw AuthException.NotLoggedIn();
            }

            var request = new ParamTcpMessage(message);

            var response = new ObjectTcpMessage <DbItem>(TcpRequestType.List);

            if (request.HasParam("id"))
            {
                var id = request.GetParamAsNullableInt("id");
                if (id != null)
                {
                    var item = _dataService.GetItem(id.Value);
                    response.Add(item);
                    return(response);
                }
            }

            return(TcpMessage.Error("Missing or badly formatted query parameters"));
        }
コード例 #3
0
ファイル: AuthDataService.cs プロジェクト: TimotejRybar/sdb
        public override DbItem GetItem(int id)
        {
            if (!IsAuthenticated)
            {
                throw AuthException.NotLoggedIn();
            }

            return(_dataService.GetItem(id));
        }