/// <summary>
 ///
 /// </summary>
 public static void FecharFormAplicacaoCronograma()
 {
     if (CronogramaController.VerificarSeFormCronogramaEstaAberto())
     {
         CronogramaView cronograma = Application.OpenForms.OfType <CronogramaView>().FirstOrDefault();
         cronograma.Close();
     }
 }
        /// <summary>
        /// Método chamado quando o usuário abre uma janela
        /// </summary>
        /// <param name="e">SingleChoiceActionExecuteEventArgs</param>
        protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs e)
        {
            if ((e.SelectedChoiceActionItem != null) &&
                e.SelectedChoiceActionItem.Id == "Cronograma")
            {
                ObjectSpace objectSpace = (ObjectSpace)Application.CreateObjectSpace();

                CronogramaPresenter.ServicoPlanejamento = new PlanejamentoServiceUtil();
                CronogramaPresenter.ServicoGeral        = new GeralServiceUtil();
                CronogramaView cronograma = new CronogramaView();

                if (!cronograma.IsDisposed)
                {
                    cronograma.Show();
                }

                return;
            }
            else if (e.SelectedChoiceActionItem != null &&
                     (e.SelectedChoiceActionItem.Id == "Configuracao_ListView" || e.SelectedChoiceActionItem.Id == "Configuracao_DetailView" ||
                      e.SelectedChoiceActionItem.Id == "Configuração"))
            {
                ObjectSpace objectSpace = (ObjectSpace)Application.CreateObjectSpace();

                using (XPCollection itens = new XPCollection(objectSpace.Session, typeof(Configuracao)))
                {
                    if (itens.Count > 0)
                    {
                        e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, itens[0]);
                    }
                    else
                    {
                        e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, new Configuracao(objectSpace.Session));
                    }
                }

                e.ShowViewParameters.TargetWindow = TargetWindow.Default;

                // Cancel the default processing for this navigation item.
                return;
            }
            else if (e.SelectedChoiceActionItem.Id != null && e.SelectedChoiceActionItem.Id == "PlanejamentoFerias_DetailView")
            {
                ObjectSpace obj = Application.CreateObjectSpace() as ObjectSpace;

                TimeLine line = new TimeLine(obj.Session);
                line.Show();

                return;
            }
            else if (e.SelectedChoiceActionItem.Id != null && e.SelectedChoiceActionItem.Id == "MeusDados_DetailView")
            {
                ObjectSpace obj = Application.CreateObjectSpace() as ObjectSpace;

                e.SelectedChoiceActionItem.Data = null;

                Colaborador colab = Colaborador.GetColaboradorCurrent(obj.Session, new Guid(SecuritySystem.CurrentUserId.ToString()));

                e.ShowViewParameters.CreatedView = Application.CreateDetailView(obj, "MeusDados_DetailView", true, colab);

                //e.SelectedChoiceActionItem.Id = "PlanejamentoFerias_DetailView";

                e.ShowViewParameters.TargetWindow = TargetWindow.Default;

                return;
            }



            //Continue the default processing for other navigation items.
            base.ShowNavigationItem(e);
        }