private IEnumerable <IDisposable> Binding()
        {
            yield return(DocumentManagerViewModel.WhenAnyValue(x => x.IsBusy).Subscribe(isBusy => IsBusy = isBusy));

            yield return
                (this.WhenAnyValue(x => x.HasDocument)
                 .Where(doc => doc != null)
                 .Subscribe(DocumentManagerViewModel.SetHasDocument));

            yield return
                (this.WhenAny(x => x.SelectedDocument).Where(doc => doc != null && doc.Content == null).Subscribe(
                     doc =>
            {
                var loader = new AsyncRunner <byte[]>();
                loader.RegisterFunction(
                    () =>
                {
                    using (IUnitOfWork unitOfWork = this._unitOfWorkFactory.Create())
                    {
                        var service = unitOfWork.Create <IAttachedDocumentService>();
                        return service.GetContent(doc.Rn);
                    }
                });
                var bytes = loader.GetInvokedTask().Result;
                if (bytes == null || bytes.Length == 0)
                {
                    doc.Content = null;
                }
                else
                {
                    doc.Content = bytes;
                }
            }));
        }
Example #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // документы
            var documents = new List <DockWindowViewModel>();

            DockManagerViewModel = new DocumentManagerViewModel(documents);
        }
Example #3
0
 public DocumentManagerZP()
 {
     InitializeComponent();
     documentManagerViewModel         = new DocumentManagerViewModel();
     documentManagerViewModel.GroupID = 3;
     this.DataContext = documentManagerViewModel;
 }
        public ActionResult Index()
        {
            var           authorizedProjectIds = m_dbAdapter.Authority.GetAuthorizedProjectIds();
            var           projects             = m_dbAdapter.Project.GetProjects(authorizedProjectIds);
            List <object> projectList          = new List <object>();

            foreach (var project in projects)
            {
                projectList.Add(new { ProjectName = project.Name, ProjectGuid = project.ProjectGuid, Selected = false });
            }

            var           documentTypes = m_dbAdapter.Document.GetAllDocumentType();
            List <object> typeList      = new List <object>
            {
                new { TypeId = "default", TypeName = "所有", Selected = true }
            };

            foreach (var type in documentTypes)
            {
                typeList.Add(new { TypeId = type.DocumentTypeId, TypeName = type.TypeName, Selected = false });
            }

            var documentManagerViewModel = new DocumentManagerViewModel
            {
                Projects      = projectList,
                DocumentTypes = typeList
            };

            return(View(documentManagerViewModel));
        }
Example #5
0
        public DocumentManager()
        {
            InitializeComponent();
            //App app = Application.Current as App;
            documentManagerViewModel         = new DocumentManagerViewModel();
            documentManagerViewModel.GroupID = 0;
            this.DataContext = documentManagerViewModel;

            //app.DocumentManagerViewModel;
        }
Example #6
0
        public App()
        {
            LogonViewModel               = new LogonViewModel();
            MainPageViewModel            = new MainPageViewModel();
            LogonUserViewModel           = new LogonUserViewModel();
            UserManagerViewModel         = new UserManagerViewModel();
            FileTypeManagerViewModel     = new FileTypeManagerViewModel();
            TaxPayerTypeManagerViewModel = new TaxPayerTypeManagerViewModel();
            TaxPayerManagerViewModel     = new TaxPayerManagerViewModel();
            DocumentManagerViewModel     = new DocumentManagerViewModel();

            this.Startup            += this.Application_Startup;
            this.UnhandledException += this.Application_UnhandledException;
            this.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted);
            InitializeComponent();
            WebContext webContext = new WebContext();

            webContext.Authentication = new FormsAuthentication();
            this.ApplicationLifetimeObjects.Add(webContext);
        }