Beispiel #1
0
        public VersionInformationTabPage()
        {
            TreeViewColumn treeViewColumnTitle = new TreeViewColumn(Translations.GetString("Title"), cellRenderer, "text", 0);

            treeViewColumnTitle.FixedWidth = 200;
            treeViewColumnTitle.Sizing     = TreeViewColumnSizing.Fixed;
            treeViewColumnTitle.Resizable  = true;
            treeView.AppendColumn(treeViewColumnTitle);

            TreeViewColumn treeViewColumnVersion = new TreeViewColumn(Translations.GetString("Version"), cellRenderer, "text", 1);

            treeView.AppendColumn(treeViewColumnVersion);

            TreeViewColumn treeViewColumnPath = new TreeViewColumn(Translations.GetString("Path"), cellRenderer, "text", 2);

            treeView.AppendColumn(treeViewColumnPath);

            data           = new ListStore(typeof(string), typeof(string), typeof(string));
            treeView.Model = data;

            ScrolledWindow scrolledWindow = new ScrolledWindow();

            scrolledWindow.Add(treeView);
            scrolledWindow.ShadowType = ShadowType.In;

            BorderWidth = 6;


            var toplayout  = new VBox();
            var copyButton = new Button(Translations.GetString("Copy Version Info"));

            copyButton.Clicked += CopyButton_Clicked;


            toplayout.Add(copyButton);
            toplayout.Add(scrolledWindow);
            toplayout.Homogeneous = false;
            toplayout.SetChildPacking(copyButton, false, false, 0, PackType.Start);
            toplayout.SetChildPacking(scrolledWindow, true, true, 0, PackType.End);

            PackStart(toplayout, true, true, 0);

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                try {
                    AssemblyName assemblyName = assembly.GetName();
                    data.AppendValues(assemblyName.Name, assemblyName.Version?.ToString(), System.IO.Path.GetFullPath(assembly.Location));
                } catch { }
            }


            data.SetSortColumnId(0, SortType.Ascending);
        }
        VBox MakeInfoBox()
        {
            VBox vbox = new VBox();

            HBox  hboxTop    = new HBox();
            HBox  hboxBottom = new HBox();
            Label label1     = new Gtk.Label(Mono.Unix.Catalog.GetString("Click on any dock to configure."));
            Label label2     = new Gtk.Label(Mono.Unix.Catalog.GetString("Drag any dock to reposition."));

            vbox.Add(hboxTop);
            vbox.Add(label1);
            vbox.Add(label2);
            vbox.Add(hboxBottom);

            vbox.SetChildPacking(hboxTop, true, true, 0, PackType.Start);
            vbox.SetChildPacking(label1, false, false, 0, PackType.Start);
            vbox.SetChildPacking(label2, false, false, 0, PackType.Start);
            vbox.SetChildPacking(hboxBottom, true, true, 0, PackType.Start);

            return(vbox);
        }
        VBox MakeHelperInfoBox()
        {
            VBox vbox = new VBox();

            HBox  hboxTop    = new HBox();
            HBox  hboxBottom = new HBox();
            Label label1     = new Gtk.Label(Mono.Unix.Catalog.GetString("Helpers require DockManager be installed."));
            Label label2     = new Gtk.Label();

            label2.Markup = "<a href=\"https://launchpad.net/dockmanager\">https://launchpad.net/dockmanager</a>";

            vbox.Add(hboxTop);
            vbox.Add(label1);
            vbox.Add(label2);
            vbox.Add(hboxBottom);

            vbox.SetChildPacking(hboxTop, true, true, 0, PackType.Start);
            vbox.SetChildPacking(label1, false, false, 0, PackType.Start);
            vbox.SetChildPacking(label2, false, false, 0, PackType.Start);
            vbox.SetChildPacking(hboxBottom, true, true, 0, PackType.Start);

            return(vbox);
        }
Beispiel #4
0
        public void SetInfoProvider(IInfoProvider provider)
        {
            if (this.currentInfoProvider == provider)
            {
                return;
            }
            this.currentInfoProvider = provider;
            if (!providerToViewMap.ContainsKey(provider))
            {
                var views = PanelViewFactory.CreateAll(provider.InfoWidgets)
                            .Select(v => PanelViewContainer.Wrap(v))
                            .ToList();
                views.ForEach(v => v.Unpinned    += OnContainerUnpinned);
                views.ForEach(v => v.InfoProvider = provider);
                views.ForEach(v => (v.Widget as IPanelView)?.Refresh());
                providerToViewMap.Add(provider, views);
            }

            var childrenToRemove = content.Children.Where(v => !(v as PanelViewContainer).Pinned);

            foreach (var child in childrenToRemove)
            {
                content.Remove(child);
            }

            List <PanelViewContainer> newViews;

            if (!providerToViewMap.TryGetValue(provider, out newViews))
            {
                return;
            }
            foreach (var viewContainer in newViews)
            {
                bool alreadyOnPanel = viewContainer.Pinned;
                if (!alreadyOnPanel)
                {
                    content.Add(viewContainer);
                    content.SetChildPacking(viewContainer, false, false, 0, PackType.Start);
                    viewContainer.Visible = viewContainer.VisibleOnPanel;
                }
            }
            UpdatePanelVisibility();
        }
        protected virtual void Build()
        {
            //MainWindow
            Name             = "MainWindow";
            Title            = "Построение yml файла на основе заданных сервисов";
            WindowPosition   = ((WindowPosition)(4));
            DefaultWidth     = PersonalSettings.appConfig.MainWindowWidth;
            DefaultHeight    = PersonalSettings.appConfig.MainWindowHeight;
            MainWindowHeight = PersonalSettings.appConfig.MainWindowWidth;
            MainWindowWidth  = PersonalSettings.appConfig.MainWindowHeight;
            //Main Hbox for separation window
            hbox1         = new HBox();
            hbox1.Name    = "hbox1";
            hbox1.Spacing = 2;

            vbox1         = new VBox();
            vbox1.Name    = "vbox1";
            vbox1.Spacing = 1;

            label1                = new Label();
            label1.Name           = "label1";
            label1.LabelProp      = "Выбранные на данный момент";
            label1.Justify        = ((Justification)(2));
            label1.SingleLineMode = true;
            label1.Expand         = false;
            vbox1.PackStart(label1, false, false, 0);

            //For Selected Services scrolled window
            GtkScrolledWindow2            = new ScrolledWindow();
            GtkScrolledWindow2.Name       = "GtkScrolledWindow1";
            GtkScrolledWindow2.ShadowType = ((ShadowType)(1));

            //Selected Services StoreList of string and Image
            SelectedServices = new ListStore(typeof(int), typeof(string), typeof(Pixbuf), typeof(List <Options>));
            List <Options> temp = new List <Options>();

            temp.Add(new Options(AllServiceOptions.allConfigs[0]));
            temp.Add(AllServiceOptions.allConfigs[1]);
            temp.Add(AllServiceOptions.allConfigs[2]);
            temp.Add(AllServiceOptions.allConfigs[3]);
            temp.Add(AllServiceOptions.allConfigs[4]);
            SelectedServices.AppendValues(0, "Свой сервис", OwnService, temp);
            SelectedServices.SetSortColumnId(0, SortType.Ascending);

            // Selected Services IconViewSettings
            IV_SelectedServices              = new IconView(SelectedServices);
            IV_SelectedServices.CanFocus     = true;
            IV_SelectedServices.Name         = "IV_SelectedServices";
            IV_SelectedServices.ItemWidth    = IV_ItemWidth;
            IV_SelectedServices.TextColumn   = Col_DisplayName;
            IV_SelectedServices.PixbufColumn = Col_Pixbuf;
            GtkScrolledWindow2.Add(IV_SelectedServices);
            vbox1.Add(GtkScrolledWindow2);
            IV_SelectedServices.GrabFocus();
            hbox1.Add(vbox1);
            // Container child hbox1.Gtk.Box+BoxChild
            vbox2         = new VBox();
            vbox2.Spacing = 1;
            // Container child vbox2.Gtk.Box+BoxChild
            label2                = new Label();
            label2.Name           = "label2";
            label2.LabelProp      = "Список всех сервисов";
            label2.Wrap           = true;
            label2.Justify        = ((Justification)(2));
            label2.SingleLineMode = true;
            vbox2.PackStart(label2, false, false, 0);
            // Container child vbox2.Gtk.Box+BoxChild
            vbox4         = new VBox();
            vbox4.Name    = "vbox4";
            vbox4.Spacing = 1;

            // Container child vbox4.Gtk.Box+BoxChild
            hbox3         = new HBox();
            hbox3.Name    = "hbox3";
            hbox3.Spacing = 6;

            Vbox_Search         = new VBox();
            Vbox_Search.Name    = "Vbox_Search";
            Vbox_Search.Spacing = 1;

            // Container child hbox3.Gtk.Box+BoxChild
            SearchS = new Entry();
            SearchS.WidthRequest  = 230;
            SearchS.CanFocus      = true;
            SearchS.Name          = "SearchS";
            SearchS.Text          = "";
            SearchS.IsEditable    = true;
            SearchS.InvisibleChar = '●';
            SearchS.Changed      += new EventHandler(OnSearchSChanged);

            Lbl_Search                = new Label();
            Lbl_Search.Name           = "Lbl_Search";
            Lbl_Search.LabelProp      = "Строка поиска сервиса";
            Lbl_Search.Justify        = Justification.Left;
            Lbl_Search.SingleLineMode = true;
            Lbl_Search.Xalign         = 0F;

            Vbox_Search.PackStart(Lbl_Search, false, false, 0);
            Vbox_Search.PackStart(SearchS, false, false, 0);
            //Just to create empty space after input field
            Vbox_Search.PackStart(new Separator(Orientation.Horizontal), false, false, 0);
            hbox3.PackStart(Vbox_Search, false, false, 0);

            Btn_Create                 = new Button();
            Btn_Create.CanFocus        = true;
            Btn_Create.Name            = "Btn_Search";
            Btn_Create.UseUnderline    = true;
            Btn_Create.Label           = "Создать Yaml";
            Btn_Create.Image           = new Image(CreateYml);
            Btn_Create.ImagePosition   = PositionType.Top;
            Btn_Create.AlwaysShowImage = true;
            Btn_Create.Pressed        += OnCreateYmlPressed;
            hbox3.PackStart(Btn_Create, false, false, 0);

            Btn_Settings                 = new Button();
            Btn_Settings.CanFocus        = true;
            Btn_Settings.Name            = "Btn_Settings";
            Btn_Settings.UseUnderline    = true;
            Btn_Settings.Label           = "Настройки";
            Btn_Settings.Image           = new Image(Settings);
            Btn_Settings.ImagePosition   = PositionType.Top;
            Btn_Settings.AlwaysShowImage = true;
            Btn_Settings.Pressed        += OnSettingsPressed;

            //Btn_Settings.Pressed += OnCreateYmlPressed;
            hbox3.PackStart(Btn_Settings, false, false, 0);

            Loading.Wait();
            //All Services StoreList of their name and Image
            AllServices = new ListStore(typeof(int), typeof(string), typeof(Pixbuf));
            AllServices.SetSortColumnId(0, SortType.Ascending);

            GtkScrolledWindow1            = new ScrolledWindow();
            GtkScrolledWindow1.Name       = "GtkScrolledWindow1";
            GtkScrolledWindow1.ShadowType = ((ShadowType)(1));

            //Adding services to store
            int length = ServicesImg.Length;

            for (int i = 0; i < length; ++i)
            {
                AllServicesList[i].Img = null;
                if (ServicesImg[i] != null)
                {
                    AllServices.AppendValues(i, AllServicesList[i].Name, ServicesImg[i]);
                }
                else
                {
                    AllServices.AppendValues(i, AllServicesList[i].Name, DefaultServiceIcon);
                }
            }

            // All Services IconViewSettings
            IV_AllServices              = new IconView(AllServices);
            IV_AllServices.CanFocus     = true;
            IV_AllServices.Name         = "IV_AllServices";
            IV_AllServices.ItemWidth    = IV_ItemWidth;
            IV_AllServices.TextColumn   = Col_DisplayName;
            IV_AllServices.PixbufColumn = Col_Pixbuf;
            GtkScrolledWindow1.Add(IV_AllServices);
            vbox4.Add(GtkScrolledWindow1);
            IV_AllServices.GrabFocus();

            vbox4.Add(hbox3);
            vbox4.SetChildPacking(hbox3, false, false, 0, PackType.Start);
            vbox2.Add(vbox4);
            hbox1.Add(vbox2);
            Add(hbox1);
            ShowAll();
            DeleteEvent += new DeleteEventHandler(OnDeleteEvent);
            IV_AllServices.ItemActivated         += new ItemActivatedHandler(OnIV_AllServicesItemActivated);
            IV_SelectedServices.ItemActivated    += new ItemActivatedHandler(OnIV_SelectedServicesItemActivated);
            IV_SelectedServices.ButtonPressEvent += new ButtonPressEventHandler(CheckForDelete);
            settingsWindow = new SettingsWindow()
            {
                WindowClosing = ClosedSettingsWindwos
            };
            Task.Run(() => LoadVersionsOfComposeFileFromSite());
        }
Beispiel #6
0
        private void Configure()
        {
            notebook1.Binding
            .AddBinding(ViewModel, vm => vm.CurrentPage, w => w.CurrentPage)
            .InitializeFromSource();
            notebook1.SwitchPage += (o, args) =>
            {
                if (args.PageNum == 1)
                {
                    radioFixedPrices.Active = true;
                }
            };
            notebook1.ShowTabs  = false;
            buttonSave.Clicked += (sender, args) =>
            {
                deliverypointresponsiblepersonsview1.RemoveEmpty();
                ViewModel.Save(true);
            };
            buttonSave.Binding
            .AddFuncBinding(ViewModel, vm => !vm.IsInProcess && vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            buttonCancel.Clicked += (sender, args) => ViewModel.Close(false, CloseSource.Cancel);
            buttonCancel.Binding
            .AddFuncBinding(ViewModel, vm => !vm.IsInProcess, w => w.Sensitive)
            .InitializeFromSource();
            buttonInsertFromBuffer.Clicked  += (s, a) => ViewModel.SetCoordinatesFromBuffer(_clipboard.WaitForText());
            buttonInsertFromBuffer.Sensitive = ViewModel.CanEdit;
            buttonApplyLimitsToAllDeliveryPointsOfCounterparty.Clicked +=
                (s, a) => ViewModel.ApplyOrderSumLimitsToAllDeliveryPointsOfClient();
            buttonApplyLimitsToAllDeliveryPointsOfCounterparty.Sensitive = ViewModel.CanEdit;
            radioInformation.Toggled += RadioInformationOnToggled;
            radioFixedPrices.Toggled += RadioFixedPricesOnToggled;

            ybuttonOpenOnMap.Binding
            .AddBinding(ViewModel.Entity, e => e.CoordinatesExist, w => w.Visible)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            ybuttonOpenOnMap.Clicked += (s, a) => ViewModel.OpenOnMapCommand.Execute();

            #region Address entries

            entryCity.CitiesDataLoader     = ViewModel.CitiesDataLoader;
            entryStreet.StreetsDataLoader  = ViewModel.StreetsDataLoader;
            entryBuilding.HousesDataLoader = ViewModel.HousesDataLoader;
            entryCity.CitySelected        += EntryCityOnCitySelected;
            entryStreet.StreetSelected    += EntryStreetOnStreetSelected;
            entryStreet.FocusOutEvent     += EntryStreetOnFocusOutEvent;
            entryBuilding.FocusOutEvent   += EntryBuildingOnFocusOutEvent;
            entryCity.Binding.AddSource(ViewModel.Entity)
            .AddBinding(e => e.City, w => w.CityName)
            .AddBinding(e => e.CityFiasGuid, w => w.FiasGuid)
            .AddBinding(e => e.LocalityType, w => w.CityTypeName)
            .AddBinding(e => e.LocalityTypeShort, w => w.CityTypeNameShort)
            .AddSource(ViewModel)
            .AddBinding(vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            entryCity.FireCityChange();

            entryStreet.Binding.AddSource(ViewModel.Entity)
            .AddBinding(e => e.Street, w => w.StreetName)
            .AddBinding(e => e.StreetDistrict, w => w.StreetDistrict)
            .AddBinding(e => e.StreetType, w => w.StreetTypeName)
            .AddBinding(e => e.StreetTypeShort, w => w.StreetTypeNameShort)
            .AddBinding(e => e.StreetFiasGuid, w => w.FiasGuid)
            .AddSource(ViewModel)
            .AddBinding(vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            entryStreet.FireStreetChange();

            entryBuilding.Binding.AddSource(ViewModel.Entity)
            .AddBinding(e => e.BuildingFiasGuid, w => w.FiasGuid)
            .AddBinding(e => e.Building, w => w.BuildingName)
            .AddSource(ViewModel)
            .AddBinding(vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            ViewModel.CityBeforeChange     = entryCity.CityName;
            ViewModel.StreetBeforeChange   = entryStreet.StreetName;
            ViewModel.BuildingBeforeChange = entryBuilding.BuildingName;

            #endregion

            phonesview1.ViewModel = ViewModel.PhonesViewModel;

            ySpecCmbCategory.ItemsList = ViewModel.DeliveryPointCategories;
            ySpecCmbCategory.Binding
            .AddBinding(ViewModel.Entity, e => e.Category, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            ycheckHaveResidue.Binding.AddSource(ViewModel.Entity)
            .AddFuncBinding(e => e.HaveResidue.HasValue, w => w.Visible)
            .AddFuncBinding(e => e.HaveResidue.HasValue && e.HaveResidue.Value, w => w.Active)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            comboRoomType.ItemsEnum = typeof(RoomType);
            comboRoomType.Binding
            .AddBinding(ViewModel.Entity, e => e.RoomType, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            yenumEntranceType.ItemsEnum = typeof(EntranceType);
            yenumEntranceType.Binding
            .AddBinding(ViewModel.Entity, e => e.EntranceType, w => w.SelectedItem)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            entryDefaultDeliverySchedule.SetEntityAutocompleteSelectorFactory(ViewModel.DeliveryScheduleSelectorFactory);
            entryDefaultDeliverySchedule.Binding
            .AddBinding(ViewModel.Entity, e => e.DeliverySchedule, w => w.Subject)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            checkIsActive.Binding
            .AddBinding(ViewModel.Entity, e => e.IsActive, w => w.Active)
            .AddSource(ViewModel)
            .AddFuncBinding(vm => vm.CanArchiveDeliveryPoint, w => w.Sensitive)
            .InitializeFromSource();

            textComment.Binding
            .AddBinding(ViewModel.Entity, e => e.Comment, w => w.Buffer.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            labelCompiledAddress.Binding
            .AddBinding(ViewModel.Entity, e => e.CompiledAddress, w => w.LabelProp)
            .InitializeFromSource();
            entryRoom.Binding
            .AddBinding(ViewModel.Entity, e => e.Room, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            entryFloor.Binding
            .AddBinding(ViewModel.Entity, e => e.Floor, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            entryEntrance.Binding
            .AddBinding(ViewModel.Entity, e => e.Entrance, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            spinMinutesToUnload.Binding
            .AddBinding(ViewModel.Entity, e => e.MinutesToUnload, w => w.ValueAsInt)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            hboxOrganisation.Binding
            .AddFuncBinding(ViewModel.Entity, e => e.Counterparty != null && e.Counterparty.PersonType == PersonType.natural, w => w.Visible)
            .InitializeFromSource();
            ylabelOrganisation.Binding
            .AddFuncBinding(ViewModel.Entity, e => e.Counterparty != null && e.Counterparty.PersonType == PersonType.natural, w => w.Visible)
            .InitializeFromSource();
            yentryOrganisation.Binding
            .AddBinding(ViewModel.Entity, e => e.Organization, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            yentryKPP.Binding
            .AddBinding(ViewModel.Entity, e => e.KPP, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            entryDefaultWater.SetEntityAutocompleteSelectorFactory(ViewModel.NomenclatureSelectorFactory.GetDefaultWaterSelectorFactory());
            entryDefaultWater.Binding
            .AddBinding(ViewModel.Entity, e => e.DefaultWaterNomenclature, w => w.Subject)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            #region Оставлено для корректного отображения старых заказов

            yentryAddress1c.Binding.AddSource(ViewModel.Entity)
            .AddBinding(e => e.Address1c, w => w.Text)
            .AddBinding(e => e.Address1c, w => w.TooltipText)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            labelAddress1c.Visible = yentryAddress1c.Visible = !string.IsNullOrWhiteSpace(ViewModel.Entity.Address1c);
            yentryCode1c.Binding
            .AddBinding(ViewModel.Entity, e => e.Code1c, w => w.Text)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            codeLabel.Visible = hboxCode.Visible = !string.IsNullOrWhiteSpace(ViewModel.Entity.Code1c);

            #endregion

            spinBottlesReserv.Binding
            .AddBinding(ViewModel.Entity, e => e.BottleReserv, w => w.ValueAsInt)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            ychkAlwaysFreeDelivery.Binding
            .AddBinding(ViewModel.Entity, e => e.AlwaysFreeDelivery, w => w.Active)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            ychkAlwaysFreeDelivery.Visible = ViewModel.CanSetFreeDelivery;
            lblCounterparty.LabelProp      = ViewModel.Entity.Counterparty.FullName;
            lblId.LabelProp = ViewModel.Entity.Id.ToString();

            ylabelFoundOnOsm.Binding.AddFuncBinding(ViewModel.Entity,
                                                    e => e.CoordinatesExist
                                        ? string.Format("<span foreground='{1}'>{0}</span>", e.CoordinatesText, e.FoundOnOsm ? "green" : "blue")
                                        : "<span foreground='red'>Не найден на карте.</span>",
                                                    w => w.LabelProp).InitializeFromSource();
            ylabelChangedUser.Binding.AddFuncBinding(ViewModel,
                                                     vm => vm.CoordsWasChanged
                                        ? $"Изменено: {vm.CoordsLastChangeUserName}"
                                        : "Никем не изменялись",
                                                     w => w.LabelProp).InitializeFromSource();
            ycheckOsmFixed.Binding
            .AddBinding(ViewModel.Entity, e => e.IsFixedInOsm, w => w.Active)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            ycheckOsmFixed.Visible = ViewModel.CurrentUserIsAdmin;

            chkAddCertificatesAlways.Binding
            .AddBinding(ViewModel.Entity, e => e.AddCertificatesAlways, w => w.Active)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            entryLunchTimeFrom.Binding
            .AddBinding(ViewModel.Entity, e => e.LunchTimeFrom, w => w.Time)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();
            entryLunchTimeTo.Binding
            .AddBinding(ViewModel.Entity, e => e.LunchTimeTo, w => w.Time)
            .AddBinding(ViewModel, vm => vm.CanEdit, w => w.Sensitive)
            .InitializeFromSource();

            //make actions menu
            var menu           = new Menu();
            var openClientItem = new MenuItem("Открыть контрагента");
            openClientItem.Activated += (s, a) => ViewModel.OpenCounterpartyCommand.Execute();
            menu.Add(openClientItem);
            menuActions.Menu = menu;
            menu.ShowAll();

            //Configure map
            _mapWidget = new GMapControl
            {
                MapProvider  = GMapProviders.GoogleMap,
                Position     = new PointLatLng(59.93900, 30.31646),
                MinZoom      = 0,
                MaxZoom      = 24,
                Zoom         = 9,
                WidthRequest = 500,
                HasFrame     = true
            };
            _mapWidget.Overlays.Add(_addressOverlay);
            _mapWidget.ButtonPressEvent   += MapWidgetOnButtonPressEvent;
            _mapWidget.ButtonReleaseEvent += MapWidgetOnButtonReleaseEvent;
            _mapWidget.MotionNotifyEvent  += MapWidgetOnMotionNotifyEvent;
            _mapWidget.Sensitive           = ViewModel.CanEdit;

            _vboxMap                        = new VBox();
            _comboMapType                   = new yEnumComboBox();
            _comboMapType.ItemsEnum         = typeof(MapProviders);
            _comboMapType.SelectedItem      = MapProviders.GoogleMap;
            _comboMapType.EnumItemSelected += (sender, args) =>
            {
                _mapWidget.MapProvider = MapProvidersHelper.GetPovider((MapProviders)args.SelectedItem);
            };
            _vboxMap.Add(_comboMapType);
            _vboxMap.SetChildPacking(_comboMapType, false, false, 0, PackType.Start);
            _vboxMap.Add(_mapWidget);
            _vboxMap.ShowAll();

            sidePanelMap.Panel         = _vboxMap;
            sidePanelMap.IsHided       = false;
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            UpdateAddressOnMap();

            if (ViewModel.DeliveryPoint.Counterparty.IsForRetail)
            {
                ySpinLimitMin.ValueAsInt = int.MinValue;
                ySpinLimitMax.ValueAsInt = int.MaxValue;

                ySpinLimitMin.Sensitive = ViewModel.CanEditOrderLimits;
                ySpinLimitMax.Sensitive = ViewModel.CanEditOrderLimits;

                ySpinLimitMin.Binding.AddBinding(ViewModel.Entity, e => e.MinimalOrderSumLimit, w => w.ValueAsInt).InitializeFromSource();
                ySpinLimitMax.Binding.AddBinding(ViewModel.Entity, e => e.MaximalOrderSumLimit, w => w.ValueAsInt).InitializeFromSource();

                //FIXME этот виджет следовало бы переписать на VM + V
                deliverypointresponsiblepersonsview1.UoW                = ViewModel.UoW;
                deliverypointresponsiblepersonsview1.DeliveryPoint      = ViewModel.DeliveryPoint;
                deliverypointresponsiblepersonsview1.ResponsiblePersons = ViewModel.ResponsiblePersons;
                deliverypointresponsiblepersonsview1.Sensitive          = ViewModel.CanEdit;
            }
            else
            {
                labelLimit.Visible = false;
                hboxLimits.Visible = false;
                deliverypointresponsiblepersonsview1.Visible = false;
                labelResponsiblePersons.Visible = false;
            }
        }
Beispiel #7
0
    public StryroDesign(string[] args)
    {
        Application.Init();
        store = new ListStore(typeof(string));

        window = new Window("Styro Design");
        window.SetSizeRequest(800, 600);
        window.DeleteEvent += new DeleteEventHandler(Window_Delete);

        vbox1 = new VBox();
        window.Add(vbox1);
        handlebox1 = new HandleBox();
        //vbox1.Add(handlebox1);
        menubar = new MenuBar();
        handlebox1.Add(menubar);
        hpan = new HPaned();
        vbox1.Add(hpan);

        vbox2 = new VBox();
        hpan.Add(vbox2);
        swin1 = new ScrolledWindow();
        vbox2.Add(swin1);
        vport1 = new Viewport();
        swin1.Add(vport1);
        treeview1 = new TreeView();
        vport1.Add(treeview1);
        vbuttonbox1             = new VButtonBox();
        vbuttonbox1.BorderWidth = 5;
        vbuttonbox1.Spacing     = 5;
        vbox2.Add(vbuttonbox1);
        vbox2.SetChildPacking(vbuttonbox1, false, false, 5, Gtk.PackType.Start);

        entry1 = new Entry();
        vbuttonbox1.Add(entry1);

        buttonAdd       = new Button();
        buttonAdd.Label = "Hinzufgen";
        vbuttonbox1.Add(buttonAdd);
        vbuttonbox1.Layout = ButtonBoxStyle.Start;

        swin = new ScrolledWindow();
        hpan.Add(swin);
        vport2 = new Viewport();
        swin.Add(vport2);
        drawing = new Display(0.3f, 2000, 2000, store);
        vport2.Add(drawing);

        treeview1.HeadersVisible = true;
        buttonAdd.Clicked       += new EventHandler(OnAddClicked);
        TreeViewColumn col  = new TreeViewColumn();
        CellRenderer   cell = new CellRendererText();

        col.Title = "Befehl";
        col.PackStart(cell, true);
        col.AddAttribute(cell, "text", 0);
        treeview1.AppendColumn(col);

        treeview1.Model = store;

        window.ShowAll();
        Application.Run();
    }