// GET: ChatFeeds/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChatFeed chatFeed = db.ChatFeeds.Find(id);

            if (chatFeed == null)
            {
                return(HttpNotFound());
            }

            string identa = User.Identity.Name;

            var viewModel = new ChatViewModel
            {
                ChatFeed          = chatFeed,
                ApplicationUser02 = (from a in db.Users
                                     where a.UserName == identa
                                     select a).First()
            };

            return(View(viewModel));

            //return View(chatFeed);
        }
Exemple #2
0
        public ChatClient(string streamPath, string userName)
        {
            _userName = userName;

            string key = "EventStore:BaseUrl";
            string baseUrl = System.Configuration.ConfigurationManager.AppSettings[key];
            if (string.IsNullOrEmpty(baseUrl))
            {
                throw new Exception("AppSetting '{0}' has not been set".FormatWith(key));
            }
            _eventStoreReader = new EventStoreReader(baseUrl, streamPath);
            _eventStoreWriter = new EventStoreWriter(baseUrl, streamPath);

            _messageRepository = new MessageRepository(_eventStoreReader);

            //_historyLogger = new LocalHistoryLogger(userName);
            //_historyReader = new LocalHistoryReader(userName);

            Feed = new ChatFeed(_messageRepository, _cancellationTokenSource.Token);

            _publisher = new ChatPublisher();
            //_publisher.Subscribe(_historyLogger);
            _publisher.Subscribe(_eventStoreWriter);

            Queue = new ChatQueue();
            Queue.Subscribe(_publisher);

            _publisher.Subscribe(Queue);   // CAUTION? - two way loop...
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ChatFeed chatFeed = db.ChatFeeds.Find(id);

            db.ChatFeeds.Remove(chatFeed);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "TweetID,TweetContent,TweetDate,UserName")] ChatFeed chatFeed)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chatFeed).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(chatFeed));
 }
        public ActionResult Create([Bind(Include = "TweetID,TweetContent,TweetDate,ApplicationUser02_Id")] ChatFeed chatFeed)
        {
            if (ModelState.IsValid)
            {
                db.ChatFeeds.Add(chatFeed);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(chatFeed));
        }
        // GET: ChatFeeds/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChatFeed chatFeed = db.ChatFeeds.Find(id);

            if (chatFeed == null)
            {
                return(HttpNotFound());
            }
            return(View(chatFeed));
        }
Exemple #7
0
    private void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        // Ad a callback to our input for when we press enter
        //Input.onEndEdit.AddListener(delegate
        //{
        //    if (UnityEngine.Input.GetKeyDown(KeyCode.Return))
        //    {
        //
        //
        //        Close();
        //    }
        //});
        Close();
    }