Beispiel #1
0
 private void FormItem_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (childWindow != null)
     {
         childWindow = null;
     }
 }
Beispiel #2
0
 public void MyTestCleanup()
 {
     _container   = null;
     _childWindow = null;
     _childWindow = null;
     _viewmodel   = null;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="args"></param>
        public void MdiClosing(object obj, RoutedEventArgs args)
        {
            IChildWindow content = ((IChildWindow)(((MdiChild)obj).Content));

            args.Handled = !content.ViewModel.Close(false);

            if (content is PcgWindow)
            {
                ViewModel.OpenedPcgWindows.RemoveWindowWithPcgMemory(content.Memory);
            }

            // Set child windows of children.
            ViewModel.ChildWindows.Clear();
            foreach (MdiChild child in Container.Children)
            {
                ViewModel.ChildWindows.Add((IChildWindow)(child.Content));
            }

            // Set current child view model.
            if (Container.Children.Count > 0)
            {
                UIElement lastContent = Container.Children[Container.Children.Count - 1].Content;
                if (lastContent is PcgWindow)
                {
                    ViewModel.CurrentChildViewModel = (lastContent as PcgWindow).ViewModel;
                }
            }
        }
 public void MyTestInitialize()
 {
     _container   = UnityContainerResolver.Container;
     _mainWindow  = _container.Resolve <IMainWindow>();
     _childWindow = _container.Resolve <IChildWindow>();
     _viewmodel   = new MainWindowViewModel(_mainWindow, _childWindow);
 }
Beispiel #5
0
        /// <summary>
        /// Ferme la fenêtre enfant.
        /// </summary>
        private void Close()
        {
            if (_childWindow != null && _onClosed != null)
            {
                _onClosed(_childWindow.DialogResult);
            }

            if (_adorner != null)
            {
                _adorner.Detach();
            }

            _isChildWindowOpened = false;

            if (_childWindow != null)
            {
                _childWindow.Closed  -= new EventHandler(OnChildWindow_Closed);
                _childWindow.Closing -= new CancelEventHandler(OnChildWindow_Closing);
            }
            if (_parentWindow != null)
            {
                _parentWindow.Closed -= new EventHandler(OnParentWindow_Closed);
            }
            Application.Current.Exit -= new ExitEventHandler(OnApplicationExit);

            _childWindow  = null;
            _onClosing    = null;
            _onClosed     = null;
            _parentWindow = null;
        }
 public SettingWindowViewModel(IChildWindow childWindow,IEventAggregator eventAggregator, IGlobalParametersService globalParametersService, IUnityContainer container, ILogService logService) {
   _eventAggregator = eventAggregator;
   _globalParametersService = globalParametersService;
   _container = container;
   _logService = logService;
   _childWindow = childWindow;
   NewSettings = new Settings();
   OkCommand=new DelegateCommand(Ok);
   CancelCommand=new DelegateCommand(Cancel);
   FolderSelectCommand=new DelegateCommand(FolderSelect);
   ErrorVisibility = Visibility.Collapsed;
   ErrorMessage = string.Empty;
   OnLoadCommand = new DelegateCommand(OnLoad);
 }
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //MyApp.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow)properties.get_Value("ChildWindow");
            }
            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }


            // CUSTOM MENUS
            // Definir os menus
            menuItem = new ExtenderMenuItems();
            var childItems = menuItem.Add("miExtensibilidade", "&Extensibilidade").ChildItems;

            childItems.Add("miXItem1", "Item &1");
            childItems.Add("miXItem2", "Item &2");
            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }
Beispiel #8
0
 public SettingWindowViewModel(IChildWindow childWindow, IEventAggregator eventAggregator, IGlobalParametersService globalParametersService, IUnityContainer container, ILogService logService)
 {
     _eventAggregator         = eventAggregator;
     _globalParametersService = globalParametersService;
     _container          = container;
     _logService         = logService;
     _childWindow        = childWindow;
     NewSettings         = new Settings();
     OkCommand           = new DelegateCommand(Ok);
     CancelCommand       = new DelegateCommand(Cancel);
     FolderSelectCommand = new DelegateCommand(FolderSelect);
     ErrorVisibility     = Visibility.Collapsed;
     ErrorMessage        = string.Empty;
     OnLoadCommand       = new DelegateCommand(OnLoad);
 }
Beispiel #9
0
        public void ShowWindow()
        {
            if (childWindow == null)
            {
                childWindow = SystemHandler.GeneralChildWindow.GetNewInstance();
            }
            childWindow.Caption = "Custom Item";
            //childWindow.Init("Artigo:", true, true, null, this);

            //
            // Construir menus da janela
            // 1. Botões
            var xternderMenuItems = new ExtenderMenuItems();
            var m = xternderMenuItems.Add("xAction1", "Acção 1");

            m.ActionType = ExtenderActionType.ExtenderActionPrimary;

            m            = xternderMenuItems.Add("xAction2", "Acção 2");
            m.ActionType = ExtenderActionType.ExtenderActionSecondary;

            //
            //2. Opções
            m            = xternderMenuItems.Add("xOpcoes", "Opções");
            m.GroupType  = ExtenderGroupType.ExtenderGroupTypeExtraOptions;
            m.BeginGroup = true;
            m.ChildItems.Add("xOpcoes1", "Opção 1");
            m.ChildItems.Add("xOpcoes2", "Opção 2");


            childWindow.Init("Artigo:", false, false, xternderMenuItems, this);

            //Translate to twips
            childWindow.SetClientArea(this.Width * 15, this.Height * 15);
            childWindow.CenterOnScreen();

            this.Visible = true;
            childWindow.Show();

            //Enable panel
            if (childWindow.EditState == EditStateType.esNull)
            {
                childWindow.EditState = EditStateType.esNew;
            }
        }
Beispiel #10
0
        /// Afficher une fenêtre enfant.
        /// </summary>
        /// <param name="source">L'objet source. Il doit appartenir à une fenêtre affichée.</param>
        /// <param name="childWindow">La fenêtre enfant à afficher.</param>
        /// <param name="onClosed">Un délégué appelé lorsque la fenêtre est sur le point d'être fermée. Définir la valeur de retour à <c>true</c> pour annuler la fermeture.</param>
        /// <param name="onClosed">Un délégué appelé lorsque la fenêtre est fermée.</param>
        public void ShowDialog(DependencyObject source, IChildWindow childWindow, Func <bool> onClosing = null, Action <bool?> onClosed = null)
        {
            Assertion.NotNull(source, "source");
            Assertion.NotNull(childWindow, "window");

            if (_isChildWindowOpened)
            {
                throw new Exception("A child window cannot be opened because there is already one displayed");
            }

            var parentWindow = source as Window ?? source.TryFindParent <Window>();

            if (parentWindow == null)
            {
                throw new ArgumentException("The parent window of the source argument cannot be found", "source");
            }

            var firstFocusableChild = parentWindow.FindFirstChild <AdornerDecorator>();

            if (firstFocusableChild == null)
            {
                throw new Exception("The child window cannot be shown because the parent window doesn't have any adorner decorator");
            }

            _isChildWindowOpened = true;
            _onClosing           = onClosing;
            _onClosed            = onClosed;
            _childWindow         = childWindow;
            _parentWindow        = parentWindow;

            _childWindow.Closing     += new CancelEventHandler(OnChildWindow_Closing);
            _childWindow.Closed      += new EventHandler(OnChildWindow_Closed);
            _parentWindow.Closed     += new EventHandler(OnParentWindow_Closed);
            Application.Current.Exit += new ExitEventHandler(OnApplicationExit);

            _adorner = new ChildWindowAdorner(firstFocusableChild.Child, childWindow);

            childWindow.OnShown();
        }
 private void ShowSettings() {
   _childWindow = _container.Resolve<IChildWindow>();
   _childWindow.SetOwner(App.Current.MainWindow);
   _childWindow.ShowDialog();
 }
Beispiel #12
0
        private void MyEvents_OnStartup(object Sender, ExtenderEventArgs e)
        {
            ExtendedPropertyList properties = null;;
            ExtenderMenuItems    menuItem;

            //APIEngine.SystemSettings.WorkstationInfo.Touch.CompanyLogoPosition = 1;

            properties = (ExtendedPropertyList)e.get_data();

            //this property will only be available in the backoffice
            if (properties.PropertyExists("ChildWindow"))
            {
                generalChildWindow = (IChildWindow)properties.get_Value("ChildWindow");
            }
            //this property will only be available in the backoffice
            if (properties.PropertyExists("WorkspaceWindow"))
            {
                generalWorkspaceWindow = (IWorkspaceWindow)properties.get_Value("WorkspaceWindow");
            }
            //this property will be available in both backoffice and frontoffice
            if (properties.PropertyExists("DialogWindow"))
            {
                generalDialogWindow = (IDialogWindow)properties.get_Value("DialogWindow");
            }

            // CUSTOM MENUS
            // Definir os menus
            // Botão simples
            menuItem = new ExtenderMenuItems();
            var simpleButton = menuItem.Add("miSimpleButton", "Exemplo de janela");

            // Colocar o caminho para o icone.
            // Não usar os nomes de ficheiro da Sage em:
            //      TARGETDIR\Icons50c
            //      TARGETDIR\Images
            var myTargetDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            myTargetDir = System.IO.Path.Combine(myTargetDir, "Icons");
            simpleButton.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-01.png");
            var simpleButton2 = menuItem.Add("miSimpleButton1", "Exemplo 2 de janela");

            simpleButton2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-02.png");

            // Botão com submenu
            var parentButton = menuItem.Add("miComplexButton", "Grupo");
            var parentBtn1   = parentButton.ChildItems.Add("miComplexButtonItem1", "Clique aqui para ver uma mensagem do Grupo!");

            parentBtn1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            //menuItem.Add("miItemView", "Alterar Artigos");

            var parentButton2 = menuItem.Add("miComplexButton2", "Grupo");
            var child1        = parentButton2.ChildItems.Add("miComplexButtonItem2", "SubGrupo");
            var childItem1    = child1.ChildItems.Add("miComplexButtonItem3", "Clique aqui para ver uma mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem1.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");
            var childItem2 = child1.ChildItems.Add("miComplexButtonItem4", "Clique aqui para ver outra mensagem do SubGrupo!", "miComplexButtonItem3");

            childItem2.PictureName = System.IO.Path.Combine(myTargetDir, "icon-sample-03.png");

            // Custom Functions
            // Remember, all functions declared here will not recorded on physical base
            AddMyFunction("XFunctionA", "PTG");
            AddMyFunction("XPosDisplay", "PTG");

            //
            // COM mandatories
            object oMenuItem = menuItem;

            properties.set_Value("ExtenderMenuItems", ref oMenuItem);

            //Use this property if you want Sage Retail to rebuild the permissions tree...
            //object rebuildPermissionsTree = true;
            //properties.set_Value("RebuildPermissionsTree", rebuildPermissionsTree);

            object oProps = properties;

            e.result.set_data(ref oProps);

            menuItem = null;
        }
Beispiel #13
0
 public MainWindowViewModel(IMainWindow mainWindow, IChildWindow childWindow)
 {
     _mainWindow  = mainWindow;
     _childWindow = childWindow;
 }
 private void ShowSettings()
 {
     _childWindow = _container.Resolve <IChildWindow>();
     _childWindow.SetOwner(App.Current.MainWindow);
     _childWindow.ShowDialog();
 }
        public void ShowDetail(IChildWindow parentViewModel, BacklogItem item)
        {
            Item = item;
            SuggestedHours = null;

            ((DelegateCommand)NavigateToNextItemCommand).NotifyCanExecuteChanged();
            ((DelegateCommand)NavigateToPreviousItemCommand).NotifyCanExecuteChanged();

            if (!View.IsVisible)
                Show(parentViewModel);

            oldItem = Item.Clone();
            SetIdealHours();
            SetIsInEditMode();

            ArtifactListViewModel.ChangeContext(ArtifactContexts.BACKLOGITEM_ARTIFACT, Item.BacklogItemUId, RefreshBacklogItemArtifactCount);

            TaskListViewModel.Item = this.Item;
        }
 public ChildWindowViewModel(IChildWindow childWindow,
                             IChildWindowNested childWindowNested)
 {
     _childWindow       = childWindow;
     _childWindowNested = childWindowNested;
 }
 public virtual void Show(IChildWindow parent)
 {
     ParentViewModel = parent;
     ParentViewModel.ShowChildWindow((IViewModel)this);
 }
        public void Show(IChildWindow parentViewModel, MemberProfile member)
        {
            isLoading = true;

            MemberProfile = member;
            OnPropertyChanged("CanActiveInative");
            IsDisabled = !MemberProfile.IsActive;
            isLoading = false;

            LoadMemberTasks();
            LoadMemberEngagedProjects();
            LoadMemberWorkingWithMembers();
            LoadMemberPerfomance();

            Show(parentViewModel);
        }
        public override void Show(IChildWindow parentViewModel)
        {
            NewProject = null;

            LoadClients();
            LoadPlatforms();

            ClientName = null;
            ProjectName = null;
            Description = null;
            Platform = null;

            base.Show(parentViewModel);
        }
 /// <summary>
 /// Shows this instance.
 /// </summary>
 public void Show(IChildWindow parentWindow)
 {
     if (Sizes == null)
         LoadItemSizes();
     base.Show(parentWindow);
 }