示例#1
0
        public AboutWPF()
        {
            InitializeComponent();

            DataContext = this;

            VersionInfo = new VersionInfoModel();
        }
示例#2
0
        public VersionInfoViewModel(WindowService windowService, VersionInfoModel model) : base(windowService, model)
        {
            this.model = model;

            Loaded          = new DelegateCommand(Window_Loaded);
            DonateBtClicked = new DelegateCommand <string>(DonateBt_Clicked);

            VersionLabel = model.ObserveProperty(m => m.Version).ToReactiveProperty();
        }
示例#3
0
        internal static VersionInfoModel SaveBookInfoToCookie(int pBookID, IPrincipal pUser)
        {
            // Get BookID, VersionID & Year from Cookie
            var lLogMsg      = string.Empty;
            var pContext     = HttpContext.Current;
            var lCookieData  = CookieManagement.GetCookie(pContext);
            var lVersionInfo = new VersionInfoModel();
            var lYear        = lCookieData.Year;
            var cookieData   = new CustomPrincipalSerializerModel();

            try
            {
                using (Loreal_DEVEntities4 db = new Loreal_DEVEntities4())
                {
                    var lBook = db.Books
                                .Where(b => b.BookID == pBookID && b.Year == lYear).SingleOrDefault();

                    // Get Version and Status information; Update cookie with this and pass back to client.
                    var lVersions = GetVersionInfo(pBookID, lYear);
                    if (lVersions.Any())
                    {
                        lVersions = lVersions.OrderByDescending(v => v.VersionID).ToList();
                    }
                    var lLatestVersion = lVersions.FirstOrDefault();

                    // Update Cookie
                    cookieData.BookID    = pBookID;
                    cookieData.Book      = lBook.Book1;
                    cookieData.VersionID = lLatestVersion.VersionID;
                    cookieData.Status    = lLatestVersion.Status;

                    var lbool = CookieManagement.UpdateCookie(HttpContext.Current, pUser, cookieData);

                    // Populate VersionInfoModel
                    lVersionInfo.Status      = lLatestVersion.Status;
                    lVersionInfo.VersionID   = lLatestVersion.VersionID;
                    lVersionInfo.VersionList = lVersions;
                }
            }
            catch (Exception ex)
            {
                var lReturnMessage = String.Format("Error in SaveBookInfoToCookie.  BookID: {0}, User: {1}.", pBookID, pUser.Identity.Name);
                lLogMsg = String.Format(lReturnMessage + "ERROR MESSAGE: {0}.  SOURCE: {1}. STACKTRACE: {2}.", ex.Message, ex.Source, ex.StackTrace);
                logger.Error(lLogMsg);
            }
            return(lVersionInfo);
        }
示例#4
0
 public void AddVersionInfos(
     VersionInfoModel versionInfo)
 => Application.Current.Dispatcher.InvokeAsync(
     () => this.VersionInfos.Add(versionInfo),
     DispatcherPriority.Background);