Example #1
0
        private static void SuccessStart(HttpContext current)
        {
            // Client Info

            ClientInfoService.ClearIfNotInDbSession(); //clean table for online-statictic
            if (SettingsMain.EnableUserOnline && !Crawler.IsCrawler(current.Request))
            {
                ClientInfoService.CreateClient(
                    new ClientOnlineInfo
                {
                    SessionId        = current.Session.SessionID,
                    Address          = current.Request.UserHostAddress,
                    UserAgentOS      = ClientInfoService.GetOSName(current.Request.UserAgent),
                    UserAgentBrowser = ClientInfoService.GetBrowser(current.Request.UserAgent),
                    CountryByGeoIp   = CountryService.GetCountryNameByIp(current.Request.UserHostAddress)[0],
                    LastAccessedPath = current.Request.RawUrl,
                    Started          = DateTime.Now,
                    Ended            = DateTime.Now.AddMinutes(GetTimeoutSession())
                }
                    );
            }
            // Base Session Settings

            SessionServices.InitBaseSessionSettings();
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            _appInfo.Age = DatePicker.Value;

            if (AllowPush.IsChecked.HasValue && AllowPush.IsChecked.Value)
            {
                _appInfo.AllowPush = true;
            }
            else
            {
                _appInfo.AllowPush = false;

                //Disconnect from PUSH channel
                App.Disconnect();
            }


            ClientInfoService.SaveAppInfo(_appInfo);

            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
            else
            {
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
        }
        private void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            string displayName = DisplayNameTextBox.Text.Trim();
            string groupname   = GroupTextBox.Text.Trim();

            if (!string.IsNullOrEmpty(displayName) &&
                !string.IsNullOrEmpty(groupname) &&
                _validAge &&
                AllowPush.IsChecked.HasValue && AllowPush.IsChecked.Value)
            {
                _appInfo.AllowPush = true;
                ClientInfoService.SaveAppInfo(_appInfo);

                MakeConnection(displayName, groupname);
            }
            else if (string.IsNullOrEmpty(displayName) ||
                     string.IsNullOrEmpty(groupname))
            {
                MessageBox.Show("Enter a Displayname and Group");
            }
            else if (!_validAge)
            {
                MessageBox.Show("You must be at least 13 years old to use this application.");
            }
            else if (!AllowPush.IsChecked.HasValue || !AllowPush.IsChecked.Value)
            {
                MessageBox.Show("This application requires toast notifications. You can disable them at any time in the settings menu.");
            }
        }
        private void DatePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
        {
            _appInfo.Age = e.NewDateTime;
            ClientInfoService.SaveAppInfo(_appInfo);

            DateTime?newDate = e.NewDateTime;

            CheckDate(newDate);
        }
        public SettingsPage()
        {
            InitializeComponent();

            _appInfo = ClientInfoService.GetAppInfo();

            if (_appInfo.Age.HasValue)
            {
                DatePicker.Value = _appInfo.Age;
            }

            if (_appInfo.AllowPush)
            {
                AllowPush.IsChecked = true;
            }
        }
        public ConnectPage()
        {
            InitializeComponent();
            App.ConnectFinished += new EventHandler <AsyncCompletedEventArgs>(App_ConnectFinished);

            _appInfo = ClientInfoService.GetAppInfo();

            if (_appInfo.Age.HasValue)
            {
                DatePicker.Value = _appInfo.Age;
                CheckDate(_appInfo.Age);
            }
            if (_appInfo.AllowPush)
            {
                AllowPush.IsChecked = true;
            }
        }
Example #7
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!App.IsConnected)
            {
                if (!_isHit)
                {
                    _isHit = true;
                    NavigationService.Navigate(new Uri("/ConnectPage.xaml", UriKind.Relative));
                }
                else
                {
                    ShowDisconnected();
                }
            }
            else
            {
                StatusTextBlock.Text = string.Format("Connected as: {0}", App.ClientInfo.DisplayName);
                PageTitle.Text       = App.ClientInfo.ChannelName;

                SendButton.Visibility   = System.Windows.Visibility.Visible;
                InputTextBox.Visibility = System.Windows.Visibility.Visible;

                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = true;
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = false;

                PushServiceClient.GetLastMessages(App.ClientInfo);
            }

            _appInfo = ClientInfoService.GetAppInfo();

            if (App.IsTrial)
            {
                BuyButton.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                BuyButton.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Title      = string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_OnLineUsers_SubHeader);
     grid.DataSource = ClientInfoService.GetAllInfo();
     grid.DataBind();
 }
Example #9
0
 public static void SaveClientInfo()
 {
     ClientInfoService.SaveClientInfo(_clientInfo);
 }
        public void GetClientInfo_WhenCalled_ReturnsValidObject()
        {
            //Arrange
            var clientInfoService = new ClientInfoService();
            clientInfoService.CommunicationService = Mock.Create<ICommunicationService>();
            clientInfoService.InitParams = Mock.Create<IApplicationSettings>();
            clientInfoService.MainViewModel = Mock.Create<IShell>();

            //Act
            var info = clientInfoService.GetClientInfo();

            //Assert
            Assert.IsNotNull(info);
        }