public ActionResult GetChatRooms()
        {
            // Create a list of chat rooms to be used by view
            var chatrooms = new ChatRoomsViewModel();

            return(this.Json(new SelectList(chatrooms.Rooms), JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public MainWindow()
        {
            //Log config
            var config     = new LoggingConfiguration();
            var fileTarget = new FileTarget();

            config.AddTarget("file", fileTarget);
            string folderPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "AngelsChat");
            string filePath   = System.IO.Path.Combine(folderPath, "UserLog.txt");

            if (!System.IO.Directory.Exists(folderPath))
            {
                System.IO.Directory.CreateDirectory(folderPath);
            }
            if (!File.Exists(filePath))
            {
                File.Create(filePath);
            }
            fileTarget.FileName = filePath;
            fileTarget.Layout   = @"${longdate} ${level:upperCase=true} ${message} ${callsite:includeSourcePath=true} ${stacktrace:topFrames=10} ${exception:format=ToString} ${event-properties:property1}";
            var rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget);

            config.LoggingRules.Add(rule2);
            LogManager.Configuration = config;
            //End Log config


            DataContext = new ChatRoomsViewModel(_client, ShowMessage);
            InitializeComponent();
        }
Esempio n. 3
0
        public IActionResult ChatRooms(string userName)
        {
            if (String.IsNullOrEmpty(userName))
            {
                return(RedirectToAction("Login"));
            }
            ChatRoomsViewModel model = new ChatRoomsViewModel();

            model.Username = userName;
            return(View(model));
        }
Esempio n. 4
0
        public ChatLister()
        {
            InitializeComponent();
            _chatListViewModel       = new ChatRoomsViewModel();
            List_View.BindingContext = _chatListViewModel;
            head.IsVisible           = false;
            head.BindingContext      = _chatListViewModel.IsNoInternet;

            MessagingCenter.Subscribe <object, ChatRoomLoader>(this, Constants.send_room, (sender, arg) =>
            {
                if (arg != null)
                {
                    Navigation.PushModalAsync(new ChatPage(arg));
                }
            });
        }
 public ChatRoomsView()
 {
     InitializeComponent();
     DataContext = new ChatRoomsViewModel();
 }
Esempio n. 6
0
 public void Logout(object sender, RoutedEventArgs e)
 {
     _client.Logout();
     DataContext = new ChatRoomsViewModel(_client, ShowMessage);
 }