Exemplo n.º 1
0
        private void ConfigureDlg()
        {
            ylabelSubdivision.Binding.AddFuncBinding(ViewModel.Entity, e => $"<b>{e.Subdivision.Name}</b>", w => w.LabelProp).InitializeFromSource();

            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel.Entity, e => e.PlannedCompletionDate, w => w.Date).InitializeFromSource();
            ydatepickerPlannedCompletionDate.Binding.AddBinding(ViewModel, vm => vm.CanEditDate, w => w.Sensitive).InitializeFromSource();

            ViewModel.PropertyChanged += (sender, e) => {
                if (e.PropertyName == nameof(ViewModel.CanEditStatus))
                {
                    UpdateStatusEnum();
                }
            };
            yenumcomboStatus.ItemsEnum = typeof(ComplaintStatuses);
            yenumcomboStatus.Binding.AddBinding(ViewModel.Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();
            yenumcomboStatus.Binding.AddBinding(ViewModel, vm => vm.CanEditStatus, w => w.Sensitive).InitializeFromSource();
            UpdateStatusEnum();

            ytreeviewComments.ShowExpanders = false;
            ytreeviewComments.ColumnsConfig = FluentColumnsConfig <object> .Create()
                                              .AddColumn("Время")
                                              .HeaderAlignment(0.5f)
                                              .AddTextRenderer(x => GetTime(x))
                                              .AddColumn("Автор")
                                              .HeaderAlignment(0.5f)
                                              .AddTextRenderer(x => GetAuthor(x))
                                              .AddColumn("Комментарий")
                                              .HeaderAlignment(0.5f)
                                              .AddTextRenderer(x => GetNodeName(x))
                                              .WrapWidth(300)
                                              .WrapMode(Pango.WrapMode.WordChar)
                                              .RowCells().AddSetter <CellRenderer>(SetColor)
                                              .Finish();

            var levels = LevelConfigFactory.FirstLevel <ComplaintDiscussionComment, ComplaintFile>(x => x.ComplaintFiles).LastLevel(c => c.ComplaintDiscussionComment).EndConfig();

            ytreeviewComments.YTreeModel = new LevelTreeModel <ComplaintDiscussionComment>(ViewModel.Entity.Comments, levels);

            ViewModel.Entity.ObservableComments.ListContentChanged += (sender, e) => {
                ytreeviewComments.YTreeModel.EmitModelChanged();
                ytreeviewComments.ExpandAll();
            };
            ytreeviewComments.ExpandAll();
            ytreeviewComments.RowActivated += YtreeviewComments_RowActivated;

            ytextviewComment.Binding.AddBinding(ViewModel, vm => vm.NewCommentText, w => w.Buffer.Text).InitializeFromSource();
            ytextviewComment.Binding.AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive).InitializeFromSource();

            filesview.ViewModel = ViewModel.FilesViewModel;
            ViewModel.FilesViewModel.ReadOnly = !ViewModel.CanEdit;

            ybuttonAddComment.Clicked += (sender, e) => ViewModel.AddCommentCommand.Execute();
            ybuttonAddComment.Binding.AddBinding(ViewModel, vm => vm.CanAddComment, w => w.Sensitive).InitializeFromSource();
        }
Exemplo n.º 2
0
        void FillDialogAtDay()
        {
            addressesOverlay.Clear();
            TurnOffCheckShowOnlyDriverOrders();

            logger.Info("Загружаем заказы на {0:d}...", ViewModel.DateForRouting);
            ViewModel.InitializeData();
            UpdateRoutesPixBuf();
            UpdateRoutesButton();
            UpdateAddressesOnMap();

            var levels = LevelConfigFactory.FirstLevel <RouteList, RouteListItem>(x => x.Addresses).LastLevel(c => c.RouteList).EndConfig();

            ytreeRoutes.YTreeModel = new LevelTreeModel <RouteList>(ViewModel.RoutesOnDay, levels);
        }
Exemplo n.º 3
0
        public void Refresh()
        {
            var complaintFilterViewModel = (InfoProvider as IComplaintsInfoProvider).ComplaintsFilterViewModel;

            StartDate = complaintFilterViewModel.StartDate;
            EndDate   = complaintFilterViewModel.EndDate;

            var totalCount    = complaintsRepository.GetUnclosedComplaintsCount(InfoProvider.UoW);
            var overduedCount = complaintsRepository.GetUnclosedComplaintsCount(InfoProvider.UoW, true);

            guilties = new List <ComplaintGuiltyNode>(GetGuilties(complaintFilterViewModel));
            var levels = LevelConfigFactory
                         .FirstLevel <ComplaintGuiltyNode, ComplaintResultNode>(x => x.ComplaintResultNodes)
                         .LastLevel(c => c.ComplaintGuiltyNode).EndConfig();

            var complaintResults = complaintsRepository.GetComplaintsResults(InfoProvider.UoW, StartDate, EndDate);

            Application.Invoke((s, args) => DrawRefreshed(complaintFilterViewModel, totalCount, overduedCount, levels, complaintResults));
        }