public void SelectAndClose(UserNode selectedNode)
        {
            if (selectedNode != null)
            {
                try
                {
                    UserSettingsChangedEventArgs args = new UserSettingsChangedEventArgs();

                    EventTopic userSettingsTopic = WorkItem.EventTopics.Get(Imi.SupplyChain.UX.UXEventTopicNames.UserSettingsChangedTopic);

                    if (userSettingsTopic != null)
                    {
                        userSettingsTopic.Fire(this, args, WorkItem, PublicationScope.Descendants);

                        if (args.OpenDialogs.Count > 0)
                        {
                            if (ShellInteractionService.ShowMessageBox(this.View.Title, string.Format(LocalResources.ChangeUserSettings_CloseAll, string.Join("\n", args.OpenDialogs)), null, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                            {
                                Close();
                                return;
                            }
                        }
                    }

                    ShellInteractionService.ShowProgress();

                    UserSessionService.NodeId = selectedNode.NodeIdentity;

                    ModifyUserDetailsParameters modifyUserDetailsParameters = new ModifyUserDetailsParameters();
                    modifyUserDetailsParameters.UserIdentity       = UserSessionService.UserId;
                    modifyUserDetailsParameters.LastLogonTime      = DateTime.Now;
                    modifyUserDetailsParameters.RecentNodeIdentity = selectedNode.NodeIdentity;

                    ModifyUserDetailsRequest serviceRequest = new ModifyUserDetailsRequest();
                    serviceRequest.ModifyUserDetailsParameters = modifyUserDetailsParameters;
                    Service.ModifyUserDetails(serviceRequest);

                    if (userSettingsTopic != null)
                    {
                        UserSettingsChangedEventArgs userSettingsChangedEventArgs = new UserSettingsChangedEventArgs(true);
                        userSettingsTopic.Fire(this, userSettingsChangedEventArgs, WorkItem, PublicationScope.Descendants);
                    }

                    // Set the selected Warehouse and ClientId on statusrow in container
                    ShellInteractionService.ContextInfo = string.Format(LocalResources.STATUSBAR_GATEWAYTMS_NODE,
                                                                        selectedNode.NodeIdentity,
                                                                        selectedNode.NodeName);
                    Close();
                }
                catch (Exception ex)
                {
                    ShellInteractionService.HideProgress();
                    ShellInteractionService.ShowMessageBox(StringResources.ActionException_Text, ex.Message, ex.ToString(), MessageBoxButton.Ok, MessageBoxImage.Error);
                }
                finally
                {
                    ShellInteractionService.HideProgress();
                }
            }
        }
        private void Load()
        {
            ShellInteractionService.ShowProgress();

            try
            {
                _view = WorkItem.SmartParts.AddNew(ViewType) as IDataView;

                EventHandler <DataEventArgs <object> > temp = ViewLoaded;

                if (temp != null)
                {
                    temp(this, new DataEventArgs <object>(_view));
                }

                if (_data != null)
                {
                    _view.PresentData(_data);
                }

                if (_isDetailView != null)
                {
                    _view.IsDetailView = _isDetailView.Value;
                }

                if (_update)
                {
                    _view.Update(_parameters);
                }

                if (_focus)
                {
                    _view.SetFocus();
                }

                if (!string.IsNullOrEmpty(_title))
                {
                    _view.Title = _title;
                }

                if (_refreshDataOnShow != null)
                {
                    _view.RefreshDataOnShow = _refreshDataOnShow.Value;
                }

                Content = _view;
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }
        private void StopInterfaceTraceButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                ShellInteractionService.ShowProgress();
                presenter.StopInterfaceTracing();

                RefreshInterfaceTraceStatus();
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }
        private void StartInterfaceTraceButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                ShellInteractionService.ShowProgress();
                presenter.StartInterfaceTracing(InterfaceLoggDurationUpDown.Value.Value);

                RefreshInterfaceTraceStatus();
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }
        private void StopDBTraceButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                ShellInteractionService.ShowProgress();
                presenter.StopDatabaseTracing();
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }

            EnableDisableButtons();
        }
        public void SelectAndClose(Imi.SupplyChain.OutputManager.Services.Initialization.DataContracts.OutputManager selectedOutputManager)
        {
            if (selectedOutputManager != null)
            {
                try
                {
                    UserSettingsChangedEventArgs args = new UserSettingsChangedEventArgs();

                    EventTopic userSettingsTopic = WorkItem.EventTopics.Get(Imi.SupplyChain.UX.UXEventTopicNames.UserSettingsChangedTopic);

                    if (userSettingsTopic != null)
                    {
                        userSettingsTopic.Fire(this, args, WorkItem, PublicationScope.Descendants);

                        if (args.OpenDialogs.Count > 0)
                        {
                            if (ShellInteractionService.ShowMessageBox(this.View.Title, string.Format(LocalResources.ChangeUserSettings_CloseAll, string.Join("\n", args.OpenDialogs)), null, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                            {
                                Close(false);
                                return;
                            }
                        }
                    }



                    ShellInteractionService.ShowProgress();

                    // Get the application
                    IShellModule module = WorkItem.Items.FindByType <IShellModule>().First();
                    OutputManagerSessionService.OutputManagerId = selectedOutputManager.OutputManagerIdentity;

                    // Set the selected Output Manager
                    ShellInteractionService.ContextInfo = string.Format(LocalResources.STATUSBAR_OM_CLIENT,
                                                                        selectedOutputManager.OutputManagerIdentity,
                                                                        selectedOutputManager.OutputManagerName);
                    Close(true);
                }
                catch (Exception ex)
                {
                    ShellInteractionService.HideProgress();
                    ShellInteractionService.ShowMessageBox(StringResources.ActionException_Text, ex.Message, ex.ToString(), MessageBoxButton.Ok, MessageBoxImage.Error);
                }
                finally
                {
                    ShellInteractionService.HideProgress();
                }
            }
        }
 public void ShowCreateLoadCarrierDialog()
 {
     if (viewParameters != null && currentItem != null)
     {
         CreateLoadCarrierForPackStationViewParameters loadCarrierParameters = new CreateLoadCarrierForPackStationViewParameters();
         loadCarrierParameters.ClientId           = UserSessionService.ClientId;
         loadCarrierParameters.DepartureId        = viewParameters.DepartureId;
         loadCarrierParameters.UserId             = viewParameters.UserId;
         loadCarrierParameters.ShipToCustomerId   = viewParameters.ShipToCustomerId;
         loadCarrierParameters.ShipToCustomerType = currentItem.ShipToCustomerType;
         ShellInteractionService.ShowProgress();
         try
         {
             Assembly             assembly            = Assembly.Load("Imi.SupplyChain.Warehouse.UX.Modules.PackStation");
             IModuleLoaderService moduleLoaderService = WorkItem.Services.Get <IModuleLoaderService>();
             moduleLoaderService.Load(WorkItem.RootWorkItem.WorkItems["Warehouse"], assembly);
             Type     workItemType = typeof(ControlledWorkItem <>).MakeGenericType(assembly.GetType("Imi.SupplyChain.Warehouse.UX.Modules.PackStation.CreateLoadCarrierForPackStation.CreateLoadCarrierForPackStationController"));
             WorkItem workItem     = WorkItem.WorkItems.AddNew(workItemType, "CreateLoadCarrier");
             workItem.Terminated += (s, e) =>
             {
                 DialogResult dialogResult = DialogResult.None;
                 if (workItem.Items.Get("DialogResult") != null)
                 {
                     dialogResult = (DialogResult)workItem.Items.Get("DialogResult");
                 }
                 if ((dialogResult == DialogResult.Ok) &&
                     (workItem.Items.FindByType <CreateLoadCarrierForPackStationViewResult>().Count > 0))
                 {
                     CreateLoadCarrierForPackStationViewResult result = workItem.Items.FindByType <CreateLoadCarrierForPackStationViewResult>().Last();
                     try
                     {
                         SelectToLoadCarrier(result.LoadCarrierId);
                     }
                     catch (Exception ex)
                     {
                         ShellInteractionService.ShowMessageBox(ex);
                     }
                 }
             };
             object controller = workItem.GetType().GetProperty("Controller").GetValue(workItem, null);
             controller.GetType().InvokeMember("Run", BindingFlags.InvokeMethod, null, controller, new object[] { loadCarrierParameters });
         }
         finally
         {
             ShellInteractionService.HideProgress();
         }
     }
 }
        private void GetServerInformation()
        {
            try
            {
                ShellInteractionService.ShowProgress();

                string ServerName;
                string LoggPathDirectory;

                presenter.GetServerInformation(out ServerName, out LoggPathDirectory);

                ServerNameTextBox.Text = ServerName;
                DirectoryTextBox.Text  = LoggPathDirectory;
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }
        private void RefreshInterfaceTraceStatus()
        {
            try
            {
                ShellInteractionService.ShowProgress();

                bool   LoggOn = false;
                string LoggStops;

                presenter.CheckInterfaceTracingStatus(out LoggOn, out LoggStops);

                InterfaceLoggStopTimeTextBox.Text = LoggStops;
                EnableDisableButtons();
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }
        protected List <string> UpdateDataSourceFindArtIdFromEAN(string eanCode)
        {
            bool          isUpdating          = updatingList.Contains("FindArtIdFromEAN");
            List <string> foundProductNumbers = new List <string>();

            if (!isUpdating)
            {
                updatingList.Add("FindArtIdFromEAN");

                ShellInteractionService.ShowProgress();

                try
                {
                    Imi.SupplyChain.Warehouse.UX.Contracts.Ean.ServiceContracts.FindArtIdFromEANRequest serviceRequest = new Imi.SupplyChain.Warehouse.UX.Contracts.Ean.ServiceContracts.FindArtIdFromEANRequest();
                    serviceRequest.FindArtIdFromEANParameters = new Imi.SupplyChain.Warehouse.UX.Contracts.Ean.DataContracts.FindArtIdFromEANParameters();

                    serviceRequest.FindArtIdFromEANParameters.BarCodeNumber = eanCode;
                    serviceRequest.FindArtIdFromEANParameters.ClientId      = UserSessionService.ClientId;

                    Imi.SupplyChain.Warehouse.UX.Contracts.Ean.ServiceContracts.FindArtIdFromEANResponse serviceResponse = EanService.FindArtIdFromEAN(serviceRequest);

                    if (serviceResponse != null &&
                        serviceResponse.FindArtIdFromEANResultCollection != null &&
                        serviceResponse.FindArtIdFromEANResultCollection.Count > 0)
                    {
                        foreach (Imi.SupplyChain.Warehouse.UX.Contracts.Ean.DataContracts.FindArtIdFromEANResult result in serviceResponse.FindArtIdFromEANResultCollection)
                        {
                            foundProductNumbers.Add(result.ProductNumber);
                        }
                    }
                }
                finally
                {
                    ShellInteractionService.HideProgress();
                    updatingList.Remove("FindArtIdFromEAN");
                }
            }

            return(foundProductNumbers);
        }
        public void SelectAndClose(UserWarehouse selectedWarehouse, UserCompany selectedCompany)
        {
            if ((selectedWarehouse != null) && (selectedCompany != null))
            {
                try
                {
                    UserSettingsChangedEventArgs args = new UserSettingsChangedEventArgs();

                    EventTopic userSettingsTopic = WorkItem.EventTopics.Get(Imi.SupplyChain.UX.UXEventTopicNames.UserSettingsChangedTopic);

                    if (userSettingsTopic != null)
                    {
                        userSettingsTopic.Fire(this, args, WorkItem, PublicationScope.Descendants);

                        if (args.OpenDialogs.Count > 0)
                        {
                            if (ShellInteractionService.ShowMessageBox(this.View.Title, string.Format(LocalResources.ChangeUserSettings_CloseAll, string.Join("\n", args.OpenDialogs)), null, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                            {
                                Close(false);
                                return;
                            }
                        }
                    }

                    ShellInteractionService.ShowProgress();

                    // Get the application
                    IShellModule module = WorkItem.Items.FindByType <IShellModule>().First();

                    LogonParameters logonParameters = new LogonParameters();
                    logonParameters.UserIdentity        = UserSessionService.UserId;
                    logonParameters.CompanyIdentity     = selectedCompany.CompanyIdentity;
                    logonParameters.WarehouseIdentity   = selectedCompany.WarehouseIdentity;
                    logonParameters.TerminalIdentity    = UserSessionService.TerminalId;
                    logonParameters.ApplicationIdentity = module.Id;

                    LogonRequest logonRequest = new LogonRequest();

                    logonRequest.LogonParameters = logonParameters;

                    LogonResponse response = Service.Logon(logonRequest);

                    // Set the selected Warehouse and ClientId on statusrow in container
                    ShellInteractionService.ContextInfo = string.Format(LocalResources.STATUSBAR_WH_CLIENT,
                                                                        selectedWarehouse.WarehouseIdentity,
                                                                        selectedWarehouse.WarehouseName,
                                                                        selectedCompany.CompanyIdentity,
                                                                        selectedCompany.CompanyName);
                    Close(true);
                }
                catch (Exception ex)
                {
                    ShellInteractionService.HideProgress();
                    ShellInteractionService.ShowMessageBox(StringResources.ActionException_Text, ex.Message, ex.ToString(), MessageBoxButton.Ok, MessageBoxImage.Error);
                }
                finally
                {
                    ShellInteractionService.HideProgress();
                }
            }
        }
        public void ShowComboDialog(IWorkspace workspace, bool fromLoadCarrier)
        {
            string workItemName;

            if (fromLoadCarrier)
            {
                workItemName = "FromLoadCarrierId";
            }
            else
            {
                workItemName = "ToLoadCarrierId";
            }

            if (WorkItem.WorkItems[workItemName] != null)
            {
                WorkItem.WorkItems[workItemName].Terminate();
            }
            FindLoadCarrierForPackStationFindViewParameters parameters = new FindLoadCarrierForPackStationFindViewParameters();

            if (viewParameters != null)
            {
                if (string.IsNullOrEmpty(viewParameters.DepartureId))
                {
                    parameters.DepartureId = "%";
                }
                else
                {
                    parameters.DepartureId = viewParameters.DepartureId;
                }
                if (string.IsNullOrEmpty(viewParameters.ShipToCustomerId))
                {
                    parameters.ShipToCustomerId = "%";
                }
                else
                {
                    parameters.ShipToCustomerId = viewParameters.ShipToCustomerId;
                }
                parameters.PackedBy = viewParameters.UserId;
                if (fromLoadCarrier)
                {
                    parameters.PickRowEmptyStatus = "NOTEMPTY";
                }
                else
                {
                    parameters.PickRowEmptyStatus = "EMPTY";
                }
            }
            else
            {
                parameters.DepartureId      = "%";
                parameters.ShipToCustomerId = "%";
                parameters.PackedBy         = WorkItem.Items.FindByType <PackStationSearchPanelView>().Last().CurrentItem.UserId;
                if (fromLoadCarrier)
                {
                    parameters.PickRowEmptyStatus = "NOTEMPTY";
                }
                else
                {
                    parameters.PickRowEmptyStatus = "EMPTY";
                }
            }

            parameters.WarehouseId = UserSessionService.WarehouseId;
            parameters.ClientId    = UserSessionService.ClientId;

            ShellInteractionService.ShowProgress();
            try
            {
                Assembly             assembly            = Assembly.Load("Imi.SupplyChain.Warehouse.UX.Modules.PackStation");
                IModuleLoaderService moduleLoaderService = WorkItem.Services.Get <IModuleLoaderService>();
                moduleLoaderService.Load(WorkItem.RootWorkItem.WorkItems["Warehouse"], assembly);
                Type   workItemType = typeof(ControlledWorkItem <>).MakeGenericType(assembly.GetType("Imi.SupplyChain.Warehouse.UX.Modules.PackStation.FindLoadCarrierForPackStationFind.FindLoadCarrierForPackStationFindController"));
                object workItem     = WorkItem.WorkItems.AddNew(workItemType, workItemName);
                object controller   = workItem.GetType().GetProperty("Controller").GetValue(workItem, null);
                controller.GetType().InvokeMember("Run", BindingFlags.InvokeMethod, null, controller, new object[] { workspace, parameters });
            }
            finally
            {
                ShellInteractionService.HideProgress();
            }
        }