Ejemplo n.º 1
0
 public ITdiTab OpenUndeliveriesWithCommentsPrintDlg(ITdiTab tab, UndeliveredOrdersFilterViewModel filter)
 {
     return(tab.TabParent.OpenTab(
                nameof(UndeliveriesWithCommentsPrintDlg),
                () => new UndeliveriesWithCommentsPrintDlg(filter)
                ));
 }
Ejemplo n.º 2
0
 public ITdiTab OpenUndeliveredOrderDlg(ITdiTab tab, int id = 0)
 {
     return(tab.TabParent.OpenTab(
                DialogHelper.GenerateDialogHashName <UndeliveredOrder>(id),
                () => id > 0 ? new UndeliveredOrderDlg(id) : new UndeliveredOrderDlg()
                ));
 }
Ejemplo n.º 3
0
 internal void OnSliderTabSwitched(object sender, ITdiTab tab)
 {
     if (TabSwitched != null)
     {
         TabSwitched(this, new TabSwitchedEventArgs(tab));
     }
 }
        public TerminalManagementViewModel(
            Warehouse defaultWarehouse,
            Employee driver,
            ITdiTab parentTab,
            IEmployeeRepository employeeRepository,
            IWarehouseRepository warehouseRepository,
            IRouteListRepository routeListRepository,
            ICommonServices commonServices,
            IUnitOfWork uow,
            ITerminalNomenclatureProvider terminalNomenclatureProvider)
        {
            UoW             = uow ?? throw new ArgumentNullException(nameof(uow));
            _driver         = driver ?? throw new ArgumentNullException(nameof(driver));
            _parentTab      = parentTab ?? throw new ArgumentNullException(nameof(parentTab));
            _commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _terminalNomenclatureProvider =
                terminalNomenclatureProvider ?? throw new ArgumentNullException(nameof(terminalNomenclatureProvider));
            _employeeRepository  = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _warehouseRepository = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _routeListRepository = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _defaultWarehouse    = defaultWarehouse;

            _author = _employeeRepository.GetEmployeeForCurrentUser(UoW);
            UpdateEntityAndRelatedProperties(
                _driver.Id > 0
                                ? _routeListRepository.GetLastTerminalDocumentForEmployee(UoW, _driver)
                                : null, false);
            _canManageTerminal = _commonServices.CurrentPermissionService.ValidatePresetPermission("role_сashier");
        }
Ejemplo n.º 5
0
        public OneWidgetDialog(Widget widget)
        {
            this.Build ();

            var att = widget.GetType ().GetCustomAttributes (typeof(WidgetWindowAttribute), false);
            if (att.Length > 0)
                this.SetDefaultSize ((att [0] as WidgetWindowAttribute).DefaultWidth,
                                     (att [0] as WidgetWindowAttribute).DefaultHeight);

            widget.Show ();
            VBox.Add (widget);

            att = widget.GetType ().GetCustomAttributes (typeof(DisplayNameAttribute), true);
            if (att.Length > 0)
                Title = (att [0] as DisplayNameAttribute).DisplayName;

            tdiTab = widget as ITdiTab;
            if(tdiTab != null)
            {
                if(!String.IsNullOrWhiteSpace (tdiTab.TabName))
                    Title = tdiTab.TabName;
                tdiTab.TabParent = this;
                tdiTab.TabNameChanged += TdiTab_TabNameChanged;
                tdiTab.CloseTab += TdiTab_CloseTab;
            }

            this.ReshowWithInitialSize ();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Добавить вкладку, указав, скрыт ли по умолчанию журнал.
        /// </summary>
        /// <param name="tab">Основная вкладка.</param>
        /// <param name="afterTab">Дочерняя вкладка.</param>
        /// <param name="CanSlided">Если true, то открываются в одной вкладке.</param>
        public void AddTab(ITdiTab tab, ITdiTab afterTab, bool CanSlided = true)
        {
            if (tab.FailInitialize)
            {
                logger.Warn("Вкладка <{0}> не добавлена, так как сообщает что построена с ошибкой(Свойство FailInitialize) .",
                            tab.TabName
                            );
                return;
            }

            if (CanSlided && afterTab == Journal && tab is ITdiDialog)
            {
                ActiveDialog = (ITdiDialog)tab;
                return;
            }

            if (afterTab == null || afterTab == Journal || afterTab == ActiveDialog)
            {
                TabParent.AddTab(tab, this as ITdiTab);
            }
            else
            {
                TabParent.AddTab(tab, afterTab);
            }
        }
Ejemplo n.º 7
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            if (DocumentUoW.Root.FromWarehouse == null)
            {
                MessageDialogWorks.RunErrorDialog("Не добавлен склад отправителя.");
                return;
            }

            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                logger.Warn("Родительская вкладка не найдена.");
                return;
            }

            var filter = new StockBalanceFilter(UnitOfWorkFactory.CreateWithoutRoot());

            filter.SetAndRefilterAtOnce(x => x.RestrictWarehouse = DocumentUoW.Root.FromWarehouse);

            ReferenceRepresentation SelectDialog = new ReferenceRepresentation(new ViewModel.StockBalanceVM(filter));

            SelectDialog.Mode            = OrmReferenceMode.Select;
            SelectDialog.ButtonMode      = ReferenceButtonMode.None;
            SelectDialog.ObjectSelected += NomenclatureSelected;

            mytab.TabParent.AddSlaveTab(mytab, SelectDialog);
        }
Ejemplo n.º 8
0
        public ITdiPage OpenTdiTabOnTdi <TTab, TCtorArg1, TCtorArg2>(ITdiTab masterTab, TCtorArg1 arg1, TCtorArg2 arg2, OpenPageOptions options = OpenPageOptions.None, Action <ContainerBuilder> addingRegistrations = null) where TTab : ITdiTab
        {
            var types  = new Type[] { typeof(TCtorArg1), typeof(TCtorArg2) };
            var values = new object[] { arg1, arg2 };

            return(OpenTdiTabOnTdi <TTab>(masterTab, types, values, options, addingRegistrations));
        }
Ejemplo n.º 9
0
 public ITdiTab OpenRouteListClosingDlg(ITdiTab master, int routelistId)
 {
     return(master.TabParent.OpenTab(
                DialogHelper.GenerateDialogHashName <RouteList>(routelistId),
                () => new RouteListClosingDlg(routelistId)
                ));
 }
Ejemplo n.º 10
0
 private void OnSwitchIn(ITdiTab tabFrom)
 {
     UpdateLastReadedMessage();
     ChatCallbackObservable.GetInstance().NotifyChatUpdate(chatUoW.Root.Id, this);
     isActive = true;
     updateTitle();
 }
        public SupplierPricesWidgetViewModel(Counterparty entity,
                                             IUnitOfWork uow,
                                             ITdiTab dialogTab,
                                             ICommonServices commonServices,
                                             IEmployeeService employeeService,
                                             ICounterpartyJournalFactory counterpartySelectorFactory,
                                             INomenclatureJournalFactory nomenclatureSelectorFactory,
                                             INomenclatureRepository nomenclatureRepository,
                                             IUserRepository userRepository)
            : base(entity, commonServices)
        {
            this.dialogTab                   = dialogTab ?? throw new ArgumentNullException(nameof(dialogTab));
            UoW                              = uow ?? throw new ArgumentNullException(nameof(uow));
            this.employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.nomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.userRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            this.counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _nomenclatureSelectorFactory     = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            CreateCommands();
            RefreshPrices();

            Search           = new SearchViewModel();
            Search.OnSearch += (sender, e) => RefreshPrices();
            Entity.ObservableSuplierPriceItems.ElementAdded   += (aList, aIdx) => RefreshPrices();
            Entity.ObservableSuplierPriceItems.ElementRemoved += (aList, aIdx, aObject) => RefreshPrices();
        }
Ejemplo n.º 12
0
        public ITdiTab OpenTab(string hashName, Func <ITdiTab> newTabFunc, ITdiTab afterTab = null, bool canSlided = true)
        {
            var tab = newTabFunc();

            RunDlg(tab);
            return(tab);
        }
Ejemplo n.º 13
0
        public ITdiTab OpenTab(string hashName, Func <ITdiTab> newTabFunc, ITdiTab afterTab = null, bool canSlided = true)
        {
            ITdiTab tab = FindTab(hashName);

            if (tab != null)
            {
                SwitchOnTab(tab);
                return(tab);
            }

            if (afterTab == Journal && ActiveDialog != null)
            {
                var askSave = (ActiveDialog as IAskSaveOnCloseViewModel)?.AskSaveOnClose ?? true;
                CloseDialog(CloseSource.FromParentPage, askSave);

                if (ActiveDialog != null)
                {
                    return(null);
                }
            }

            tab = newTabFunc();
            AddTab(tab, afterTab, canSlided);
            return(tab);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Добавить вкладку, указав, скрыт ли по умолчанию журнал.
        /// </summary>
        /// <param name="tab">Основная вкладка.</param>
        /// <param name="afterTab">Дочерняя вкладка.</param>
        /// <param name="canSlided">Если true, то открываются в одной вкладке.</param>
        public void AddTab(ITdiTab tab, ITdiTab afterTab, bool canSlided = true)
        {
            if (tab.FailInitialize)
            {
                logger.Warn("Вкладка <{0}> не добавлена, так как сообщает что построена с ошибкой(Свойство FailInitialize) .",
                            tab.TabName
                            );
                return;
            }

            if (canSlided && afterTab == Journal)
            {
                if (ActiveDialog != null)
                {
                    var askSave = (ActiveDialog as IAskSaveOnCloseViewModel)?.AskSaveOnClose ?? true;
                    CloseDialog(CloseSource.FromParentPage, askSave);
                }
                ActiveDialog = tab;
                return;
            }

            if (afterTab == null || afterTab == Journal || afterTab == ActiveDialog)
            {
                TabParent.AddTab(tab, this as ITdiTab);
            }
            else
            {
                TabParent.AddTab(tab, afterTab);
            }
        }
Ejemplo n.º 15
0
        public IPage <TViewModel> OpenViewModelOnTdi <TViewModel>(ITdiTab master, OpenPageOptions options = OpenPageOptions.None, Action <ContainerBuilder> addingRegistrations = null) where TViewModel : DialogViewModelBase
        {
            var types  = new Type[] { };
            var values = new object[] { };

            return(OpenViewModelOnTdiTypedArgs <TViewModel>(master, types, values, options, addingRegistrations));
        }
Ejemplo n.º 16
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                return;
            }

            var parentDlg = DialogHelper.FindParentEntityDialog(this);

            if (parentDlg == null)
            {
                return;
            }

            if (parentDlg.UoW.IsNew)
            {
                if (CommonDialogs.SaveBeforeCreateSlaveEntity(parentDlg.EntityObject.GetType(), typeof(Proxy)))
                {
                    parentDlg.UoW.Save();
                }
                else
                {
                    return;
                }
            }

            ITdiDialog dlg = new ProxyDlg(CounterpartyUoW.Root);

            mytab.TabParent.AddTab(dlg, mytab);
        }
Ejemplo n.º 17
0
 public void OpenCreateRouteListDlg(ITdiTab tab, int id)
 {
     tab.TabParent.OpenTab(
         DialogHelper.GenerateDialogHashName <RouteList>(id),
         () => new RouteListCreateDlg(id)
         );
 }
Ejemplo n.º 18
0
        public void AddTab(ITdiTab tab, int after = -1)
        {
            if (tab.FailInitialize)
            {
                logger.Warn("Вкладка <{0}> не добавлена, так как сообщает что построена с ошибкой(Свойство FailInitialize) .",
                            tab.TabName
                            );
                return;
            }
            HBox  box       = new HBox();
            Label nameLable = new Label(tab.TabName);

            box.Add(nameLable);
            Image  closeImage  = new Image(Stock.Close, IconSize.Menu);
            Button closeButton = new Button(closeImage);

            closeButton.Relief   = ReliefStyle.None;
            closeButton.Clicked += OnCloseButtonClicked;
            closeButton.ModifierStyle.Xthickness = 0;
            closeButton.ModifierStyle.Ythickness = 0;
            box.Add(closeButton);
            box.ShowAll();
            var journalTab = tab as ITdiJournal;

            if (journalTab != null && ((journalTab.UseSlider == null && DefaultUseSlider) || journalTab.UseSlider.Value))
            {
                TdiSliderTab slider = new TdiSliderTab((ITdiJournal)tab);
                tab = slider;
            }
            tab.CloseTab       += HandleCloseTab;
            tab.TabNameChanged += OnTabNameChanged;
            _tabs.Add(new TdiTabInfo(tab, nameLable));
            var vbox = new TabVBox(tab);
            int inserted;

            if (after >= 0)
            {
                inserted = this.InsertPage(vbox, box, after + 1);
            }
            else
            {
                inserted = this.AppendPage(vbox, box);
            }
            tab.TabParent = this;
            vbox.Show();
            this.ShowTabs = true;
            if (TabAdded != null)
            {
                TabAdded(this, new TabAddedEventArgs(tab));
            }
            this.CurrentPage = inserted;
            logger.Debug("Добавлена вкладка '{0}'", tab.TabName);

            //I-867 Если вкладка "заказы",
            if (tab is ITdiTabAddedNotifier)
            {
                //то открыть окно "контрагенты"
                ((ITdiTabAddedNotifier)tab).OnTabAdded();
            }
        }
Ejemplo n.º 19
0
 internal void OnSliderTabAdded(object sender, ITdiTab tab)
 {
     if (TabAdded != null)
     {
         TabAdded(sender, new TabAddedEventArgs(tab));
     }
 }
Ejemplo n.º 20
0
        protected void OnButtonViewDocumentClicked(object sender, EventArgs e)
        {
            ITdiTab mytab = DialogHelper.FindParentTab(this);

            if (mytab == null)
            {
                return;
            }

            CounterpartyDocumentNode selectedPrintableDocuments = (ytreeDocuments.GetSelectedObject() as CounterpartyDocumentNode);

            if (selectedPrintableDocuments.Document is CounterpartyContract)
            {
                int        contractID = (selectedPrintableDocuments.Document as CounterpartyContract).Id;
                ITdiDialog dlg        = new CounterpartyContractDlg(contractID);
                mytab.TabParent.AddTab(dlg, mytab);
            }

            if (selectedPrintableDocuments.Document is OrderDocument)
            {
                var rdlDoc = (selectedPrintableDocuments.Document as IPrintableRDLDocument);
                if (rdlDoc != null)
                {
                    mytab.TabParent.AddTab(DocumentPrinter.GetPreviewTab(rdlDoc), mytab);
                }
            }
        }
        private void Configure()
        {
            var journal = new PermissionControlledRepresentationJournal(model);

            journal.Mode            = multipleSelect ? JournalSelectMode.Multiple : JournalSelectMode.Single;
            journal.ObjectSelected += (sender, e) => {
                List <EntityNode> selectedResult = new List <EntityNode>();
                foreach (int selectedId in e.GetSelectedIds())
                {
                    selectedResult.Add(new EntityNode(selectedId, entityType));
                }
                OnEntitySelectedResult?.Invoke(sender, new JournalSelectedNodesEventArgs(selectedResult.ToArray()));
            };
            JournalTab = journal;
            JournalTab.TabNameChanged += (sender, e) => TabNameChanged?.Invoke(sender, e);
            JournalTab.TabClosed      += (sender, e) => {
                TabParent?.ForceCloseTab(this);
                journal.Destroy();
                Dispose();
            };
            journal.Destroyed += (sender, e) => {
                TabParent?.ForceCloseTab(this);
                journal.Destroy();
                Dispose();
            };
        }
Ejemplo n.º 22
0
 protected void OnTabClosed(ITdiTab tab)
 {
     if (TabClosed != null)
     {
         TabClosed(this, new TabClosedEventArgs(tab));
     }
 }
        public ComplaintDiscussionsViewModel(
            Complaint entity,
            ITdiTab dialogTab,
            IUnitOfWork uow,
            IFilePickerService filePickerService,
            IEmployeeService employeeService,
            ICommonServices commonServices,
            IEntityAutocompleteSelectorFactory employeeSelectorFactory,
            ISalesPlanJournalFactory salesPlanJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelectorFactory,
            IUserRepository userRepository
            ) : base(entity, commonServices)
        {
            _employeeSelectorFactory = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
            _filePickerService       = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            _employeeService         = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _dialogTab = dialogTab ?? throw new ArgumentNullException(nameof(dialogTab));
            _salesPlanJournalFactory     = salesPlanJournalFactory ?? throw new ArgumentNullException(nameof(salesPlanJournalFactory));
            _nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            _userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository));

            UoW = uow;
            CreateCommands();
            ConfigureEntityPropertyChanges();
            FillDiscussionsViewModels();
        }
Ejemplo n.º 24
0
 public void OpenOrderDlg(ITdiTab tab, int id)
 {
     tab.TabParent.OpenTab(
         DialogHelper.GenerateDialogHashName <Order>(id),
         () => new OrderDlg(id)
         );
 }
Ejemplo n.º 25
0
        //отрытие журнала недовоза на конкретном недовозе из диалога штрафов
        public void OpenFromFine(ITdiTab tab, Order oldOrder, DateTime?deliveryDate, UndeliveryStatus undeliveryStatus)
        {
            var undeliveredOrdersFilter = new UndeliveredOrdersFilterViewModel(
                ServicesConfig.CommonServices,
                new OrderSelectorFactory(),
                new EmployeeJournalFactory(),
                new CounterpartyJournalFactory(),
                new DeliveryPointJournalFactory(),
                new SubdivisionJournalFactory())
            {
                RestrictOldOrder          = oldOrder,
                RestrictOldOrderStartDate = deliveryDate,
                RestrictOldOrderEndDate   = deliveryDate,
                RestrictUndeliveryStatus  = undeliveryStatus
            };

            var dlg = new UndeliveredOrdersJournalViewModel(
                undeliveredOrdersFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new GtkTabsOpener(),
                new EmployeeJournalFactory(),
                VodovozGtkServicesConfig.EmployeeService,
                new UndeliveredOrdersJournalOpener(),
                new OrderSelectorFactory(),
                new UndeliveredOrdersRepository());

            tab.TabParent.AddSlaveTab(tab, dlg);
        }
Ejemplo n.º 26
0
        public TabVBox(ITdiTab tabWidget, ITDIWidgetResolver widgetResolver)
        {
            tab        = tabWidget;
            titleLabel = new Label();
            if (tab is ITdiTabWithPath)
            {
                (tab as ITdiTabWithPath).PathChanged += OnPathUpdated;
                OnPathUpdated(null, EventArgs.Empty);
            }
            else
            {
                tab.TabNameChanged += Tab_TabNameChanged;
                Tab_TabNameChanged(null, null);
            }

            this.PackStart(titleLabel, false, true, 2);

            TabWidget = widgetResolver.Resolve(tabWidget);
            if (TabWidget == null)
            {
                throw new InvalidCastException($"Ошибка приведения типа {nameof(ITdiTab)} к типу {nameof(Widget)}.");
            }

            this.Add(TabWidget);
            titleLabel.Show();
            TabWidget.Show();
        }
Ejemplo n.º 27
0
        public void ForceCloseTab(ITdiTab tab, CloseSource source = CloseSource.External)
        {
            var slider = tab.TabParent as TdiSliderTab;

            if (slider != null)
            {
                slider.ForceCloseTab(tab, source);
                return;
            }

            TdiTabInfo info = _tabs.Find(i => i.TdiTab == tab);

            if (info == null)
            {
                logger.Warn("Вкладка предположительно уже закрыта, попускаем...");
                return;
            }

            while (info.SlaveTabs.Count > 0)
            {
                ForceCloseTab(info.SlaveTabs[0], CloseSource.WithMasterPage);
            }

            CloseTab(info, source);
        }
Ejemplo n.º 28
0
 public bool AskToCloseTab(ITdiTab tab, CloseSource source)
 {
     if (MessageDialogHelper.RunQuestionDialog("Вы действительно хотите закрыть окно?"))
     {
         tab.OnTabClosed();
     }
     return(true);
 }
Ejemplo n.º 29
0
        public ITdiTab OpenTab(Func <ITdiTab> newTabFunc, ITdiTab afterTab = null, Type[] argTypes = null, object[] args = null)
        {
            ITdiTab tab      = newTabFunc.Invoke();
            Type    tabType  = tab.GetType();
            string  hashName = TabHashHelper.GetTabHash(tabType, argTypes ?? new Type[] { }, args ?? new object[] { });

            return(OpenTab(hashName, () => tab, afterTab));
        }
Ejemplo n.º 30
0
 public IPage <TViewModel> OpenViewModelOnTdiTypedArgs <TViewModel>(ITdiTab master, Type[] ctorTypes, object[] ctorValues, OpenPageOptions options = OpenPageOptions.None, Action <ContainerBuilder> addingRegistrations = null) where TViewModel : DialogViewModelBase
 {
     return((IPage <TViewModel>)OpenViewModelInternal(
                FindOrCreatePage(master), options,
                () => hashGenerator?.GetHash <TViewModel>(null, ctorTypes, ctorValues),
                (hash) => viewModelsFactory.CreateViewModelTypedArgs <TViewModel>(null, ctorTypes, ctorValues, hash, addingRegistrations)
                ));
 }
Ejemplo n.º 31
0
 public ITdiPage OpenTdiTabOnTdiNamedArgs <TTab>(ITdiTab masterTab, IDictionary <string, object> ctorArgs, OpenPageOptions options = OpenPageOptions.None, Action <ContainerBuilder> addingRegistrations = null) where TTab : ITdiTab
 {
     return((ITdiPage)OpenViewModelInternal(
                FindOrCreatePage(masterTab), options,
                () => hashGenerator?.GetHashNamedArgs <TTab>(null, ctorArgs),
                (hash) => tdiPageFactory.CreateTdiPageNamedArgs <TTab>(ctorArgs, hash, addingRegistrations)
                ));
 }
Ejemplo n.º 32
0
        public TabVBox(ITdiTab tabWidget)
        {
            tab = tabWidget;
            titleLabel = new Label ();
            if(tab is ITdiTabWithPath)
            {
                (tab as ITdiTabWithPath).PathChanged += OnPathUpdated;
                OnPathUpdated (null, EventArgs.Empty);
            }
            else
            {
                tab.TabNameChanged += Tab_TabNameChanged;
                Tab_TabNameChanged (null, null);
            }

            this.PackStart (titleLabel, false, true, 2);
            this.Add ((Widget)tab);
            titleLabel.Show ();
            (tab as Widget).Show ();
        }
Ejemplo n.º 33
0
        public ITdiTab OpenTab(string hashName, Func<ITdiTab> newTabFunc, ITdiTab afterTab = null)
        {
            ITdiTab tab = FindTab(hashName);

            if (tab == null)
            {
                if(afterTab == null)
                    AddTab(newTabFunc());
                else
                    AddTab(newTabFunc(), afterTab);
            }
            else
            {
                logger.Debug("Вкладка c хешом {0} уже открыта, переключаемся...", hashName);
                SwitchOnTab(tab);
            }

            return tab;
        }
Ejemplo n.º 34
0
 private void OnSwitchOut(ITdiTab tabTo)
 {
     if (journal != null && journal.HandleSwitchOut != null)
         journal.HandleSwitchOut(tabTo);
     if (activeDialog != null && activeDialog.HandleSwitchOut != null)
         activeDialog.HandleSwitchOut(tabTo);
 }
Ejemplo n.º 35
0
 private void OnSwitchIn(ITdiTab tabFrom)
 {
     if (journal != null && journal.HandleSwitchIn != null)
         journal.HandleSwitchIn(tabFrom);
     if (activeDialog != null && activeDialog.HandleSwitchIn != null)
         activeDialog.HandleSwitchIn(tabFrom);
 }
Ejemplo n.º 36
0
        private bool SaveIfNeed(ITdiTab tab)
        {
            if (CheckClosingSlaveTabs (tab))
                return false;

            ITdiDialog dlg;

            if (tab is ITdiDialog)
                dlg = tab as ITdiDialog;
            else if (tab is TdiSliderTab && (tab as TdiSliderTab).ActiveDialog != null)
                dlg = (tab as TdiSliderTab).ActiveDialog;
            else
                return true;

            if (dlg.HasChanges) {
                string Message = "На вкладке есть изменения. Сохранить изменения перед закрытием?";
                MessageDialog md = new MessageDialog ((Window)this.Toplevel, DialogFlags.Modal,
                                       MessageType.Question,
                                       ButtonsType.YesNo,
                                       Message);
                int result = md.Run ();
                md.Destroy ();
                if (result == (int)ResponseType.Yes) {
                    if (!dlg.Save ()) {
                        logger.Warn ("Вкладка не сохранена. Отмена закрытия...");
                        return false;
                    }
                }
                if (result == (int)ResponseType.No) {
                    (dlg as Bin).Destroy ();
                    return true;
                }
                if (result == (int)ResponseType.DeleteEvent)
                    return false;
            }
            return true;
        }
Ejemplo n.º 37
0
 public TabClosedEventArgs(ITdiTab tab)
 {
     this.tab = tab;
 }
Ejemplo n.º 38
0
 internal void OnSliderTabSwitched(object sender, ITdiTab tab)
 {
     if (TabSwitched != null)
         TabSwitched(this, new TabSwitchedEventArgs(tab));
 }
Ejemplo n.º 39
0
        private void CloseTab(ITdiTab tab)
        {
            TdiTabInfo info = _tabs.Find (i => i.TdiTab == tab);
            if(info == null)
            {
                logger.Warn("Вкладка предположительно уже закрыта, попускаем...");
                return;
            }

            if (info.SlaveTabs.Count > 0) {
                throw new InvalidOperationException ("Вкладка не может быть закрыта, если у нее есть подчинёные вкладки.");
            }

            //Закрываем вкладку
            TabVBox tabBox = GetTabBoxForTab (tab);
            bool IsCurrent = this.CurrentPageWidget == tabBox;
            _tabs.RemoveAll (t => t.TdiTab == tab);
            _tabs.ForEach (t => t.SlaveTabs.RemoveAll (s => s == tab));
            if (IsCurrent)
                this.PrevPage ();
            this.Remove (tabBox);
            var maybeSliderActiveDialog = (tab as TdiSliderTab)?.ActiveDialog;
            if (maybeSliderActiveDialog != null)
                OnTabClosed(maybeSliderActiveDialog);
            OnTabClosed(tab);
            logger.Debug ("Вкладка <{0}> удалена", tab.TabName);
            (tab as Widget).Destroy ();
            tabBox.Destroy ();
        }
 void RunDlg(ITdiTab dlg)
 {
     if (dlg is Gtk.Dialog) {
         var window = dlg as Gtk.Dialog;
         window.Show ();
         window.Run ();
         window.Destroy ();
     } else if (dlg is Gtk.Widget) {
         var window = new OneWidgetDialog (dlg as Gtk.Widget);
         window.Show ();
         window.Run ();
         window.Destroy ();
     } else
         throw new NotImplementedException ();
 }
 public void SwitchOnTab(ITdiTab tab)
 {
     throw new NotImplementedException();
 }
 public void AddTab(ITdiTab tab, ITdiTab afterTab, bool CanSlided = true)
 {
     RunDlg (tab);
 }
 public void AddSlaveTab(ITdiTab masterTab, ITdiTab slaveTab)
 {
     RunDlg (slaveTab);
 }
 public bool CheckClosingSlaveTabs(ITdiTab tab)
 {
     return true;
 }
 public ITdiTab OpenTab(string hashName, Func<ITdiTab> newTabFunc, ITdiTab afterTab = null)
 {
     var tab = newTabFunc();
     RunDlg (tab);
     return tab;
 }
Ejemplo n.º 46
0
        public static void Print(IUnitOfWork uow, RouteList routeList, ITdiTab myTab)
        {
            List<RouteListPrintableDocs> docsList = new List<RouteListPrintableDocs>
                {
                    new RouteListPrintableDocs(uow, routeList, RouteListPrintableDocuments.LoadDocument),
                    new RouteListPrintableDocs(uow, routeList, RouteListPrintableDocuments.TimeList),
                    new RouteListPrintableDocs(uow, routeList, RouteListPrintableDocuments.RouteList)
                };

            DocumentPrinter.PrintAll(docsList);

            //			List<ReportInfo> docs = new List<ReportInfo>
            //			{
            //				GetRDLLoadDocument(routeListId),
            //				GetRDLRouteList(uow, routeListId),
            //				GetRDLTimeList(routeListId)
            //			};
            //
            //			foreach (var doc in docs)
            //			{
            //				myTab.TabParent.OpenTab(
            //					TdiTabBase.GenerateHashName<ReportViewDlg>(),
            //					() => new ReportViewDlg(doc, true));
            //			}
        }
Ejemplo n.º 47
0
 public void SwitchOnTab(ITdiTab tab)
 {
     var widget = GetTabBoxForTab(tab);
     if (widget == null)
         return;
     this.CurrentPage = this.PageNum(widget);
 }
 protected override void OnParentSet(Gtk.Widget previous_parent)
 {
     mytab = null;
     base.OnParentSet (previous_parent);
 }
Ejemplo n.º 49
0
 internal void OnSliderTabClosed(object sender, ITdiTab tab)
 {
     if (TabClosed != null)
         TabClosed(sender, new TabClosedEventArgs(tab));
 }
Ejemplo n.º 50
0
        public void AddSlaveTab(ITdiTab masterTab, ITdiTab slaveTab)
        {
            TdiTabInfo info = _tabs.Find (t => t.TdiTab == masterTab);
            if (info == null)
                throw new NullReferenceException ("Мастер вкладка не найдена в списке активных вкладок.");

            var journalTab = slaveTab as ITdiJournal;
            if (journalTab != null && ((journalTab.UseSlider == null && DefaultUseSlider) || journalTab.UseSlider.Value)) {
                TdiSliderTab slider = new TdiSliderTab ((ITdiJournal)slaveTab);
                slaveTab = slider;
            }

            info.SlaveTabs.Add (slaveTab);
            this.AddTab (slaveTab, masterTab);
            var addedTabInfo = _tabs.Find (t => t.TdiTab == slaveTab);
            addedTabInfo.MasterTabInfo = info;
            OnTabNameChanged (slaveTab, new TdiTabNameChangedEventArgs (slaveTab.TabName));
        }
Ejemplo n.º 51
0
 protected void OnTabClosed(ITdiTab tab)
 {
     if(TabClosed != null)
     {
         TabClosed(this, new TabClosedEventArgs(tab));
     }
 }
Ejemplo n.º 52
0
 public void AddTab(ITdiTab tab, int after = -1)
 {
     if(tab.FailInitialize)
     {
         logger.Warn ("Вкладка <{0}> не добавлена, так как сообщает что построена с ошибкой(Свойство FailInitialize) .",
             tab.TabName
         );
         return;
     }
     HBox box = new HBox ();
     Label nameLable = new Label (tab.TabName);
     box.Add (nameLable);
     Gtk.Image closeImage = new Gtk.Image (Stock.Close, IconSize.Menu);
     Button closeButton = new Button (closeImage);
     closeButton.Relief = ReliefStyle.None;
     closeButton.Clicked += OnCloseButtonClicked;
     closeButton.ModifierStyle.Xthickness = 0;
     closeButton.ModifierStyle.Ythickness = 0;
     box.Add (closeButton);
     box.ShowAll ();
     var journalTab = tab as ITdiJournal;
     if (journalTab != null && ((journalTab.UseSlider == null && DefaultUseSlider) || journalTab.UseSlider.Value)) {
         TdiSliderTab slider = new TdiSliderTab ((ITdiJournal)tab);
         tab = slider;
     }
     tab.CloseTab += HandleCloseTab;
     tab.TabNameChanged += OnTabNameChanged;
     _tabs.Add (new TdiTabInfo (tab, nameLable));
     var vbox = new TabVBox (tab);
     int inserted;
     if (after >= 0)
         inserted = this.InsertPage (vbox, box, after + 1);
     else
         inserted = this.AppendPage (vbox, box);
     tab.TabParent = this;
     vbox.Show ();
     this.ShowTabs = true;
     if(TabAdded!=null)
         TabAdded(this, new TabAddedEventArgs(tab));
     this.CurrentPage = inserted;
     logger.Debug("Добавлена вкладка '{0}'", tab.TabName);
 }
Ejemplo n.º 53
0
 private TabVBox GetTabBoxForTab(ITdiTab tab)
 {
     return this.Children.SingleOrDefault (w => (w as TabVBox).Tab == tab) as TabVBox;
 }
Ejemplo n.º 54
0
 public void AddTab(ITdiTab tab, ITdiTab afterTab, bool CanSlided = true)
 {
     AddTab (tab, this.PageNum (GetTabBoxForTab (afterTab)));
 }
Ejemplo n.º 55
0
 public TdiTabInfo(ITdiTab tab, Label label, TdiTabInfo masterTabInfo = null)
 {
     MasterTabInfo = masterTabInfo;
     TdiTab = tab;
     TabNameLabel = label;
     SlaveTabs = new List<ITdiTab> ();
 }
Ejemplo n.º 56
0
        public bool CheckClosingSlaveTabs(ITdiTab tab)
        {
            TdiTabInfo info = _tabs.Find (i => i.TdiTab == tab);
            if (info.SlaveTabs.Count > 0) {
                string Message = "Сначала надо закрыть подчиненую вкладку.";
                MessageDialog md = new MessageDialog ((Window)this.Toplevel, DialogFlags.Modal,
                                       MessageType.Warning,
                                       ButtonsType.Ok,
                                       Message);
                md.Run ();
                md.Destroy ();
                this.CurrentPage = this.PageNum (GetTabBoxForTab(info.SlaveTabs [0]));
                return true;
            }

            return false;
        }
Ejemplo n.º 57
0
 public TabSwitchedEventArgs(ITdiTab tab)
 {
     this.tab = tab;
 }
Ejemplo n.º 58
0
 public TabAddedEventArgs(ITdiTab tab)
 {
     this.tab = tab;
 }
Ejemplo n.º 59
0
 public void SwitchOnTab(ITdiTab tab)
 {
     TabParent.SwitchOnTab(tab);
 }
Ejemplo n.º 60
0
        public ITdiTab OpenTab(string hashName, Func<ITdiTab> newTabFunc, ITdiTab afterTab = null)
        {
            ITdiTab tab = FindTab(hashName);

            if (tab != null)
            {
                SwitchOnTab(tab);
                return tab;
            }

            if(afterTab == Journal && ActiveDialog != null)
            {
                OnDialogClose (ActiveDialog, new TdiTabCloseEventArgs (true));
                if (ActiveDialog != null)
                    return null;
            }

            tab = newTabFunc();
            AddTab(tab, afterTab);
            return tab;
        }