コード例 #1
0
        void Configure()
        {
            CallNumberYLabel.Binding.AddBinding(ViewModel, v => v.PhoneText, w => w.LabelProp).InitializeFromSource();

            foreach (var item in ViewModel.CounterpartyOrdersModels)
            {
                var label  = new Gtk.Label(item.Client.Name);
                var widget = new CounterpartyOrderView(item);
                WidgetPlace.AppendPage(widget, label);
            }
            var p_label  = new Gtk.Label("+ Новый контрагент");
            var p_widget = new Button()
            {
                Name = "New"
            };

            WidgetPlace.AppendPage(p_widget, p_label);

            var ex_label  = new Gtk.Label("Существующий контрагент");
            var ex_widget = new Button()
            {
                Name = "Exist"
            };

            WidgetPlace.AppendPage(ex_widget, ex_label);

            WidgetPlace.ShowAll();


            WidgetPlace.SwitchPage += SwitchPage_WidgetPlace;
            ViewModel.CounterpartyOrdersModelsUpdateEvent += Update_WidgetPlace;

            CostAndDeliveryIntervalButton.Sensitive = ViewModel.currentCounterparty.DeliveryPoints?.Count > 0;
        }
コード例 #2
0
        public void Update_WidgetPlace()
        {
            int count = WidgetPlace.NPages;

            falseSwitching = true;            //Потому что в процессе удаления срабатывают события переключения вкладок.
            for (int i = 0; i < count; i++)
            {
                WidgetPlace.RemovePage(0);
            }
            foreach (var item in ViewModel.CounterpartyOrdersModels)
            {
                var label  = new Gtk.Label(item.Client.Name);
                var widget = new CounterpartyOrderView(item);
                WidgetPlace.AppendPage(widget, label);
            }
            var p_label  = new Gtk.Label("+ Новый контргагент");
            var p_widget = new Button()
            {
                Name = "New"
            };

            WidgetPlace.AppendPage(p_widget, p_label);

            var ex_label  = new Gtk.Label("Существующий контрагент");
            var ex_widget = new Button()
            {
                Name = "Exist"
            };

            WidgetPlace.AppendPage(ex_widget, ex_label);

            WidgetPlace.ShowAll();
            WidgetPlace.Page = (int)lastPage;
            falseSwitching   = false;

            CostAndDeliveryIntervalButton.Sensitive = ViewModel.currentCounterparty.DeliveryPoints?.Count > 0;
        }