private void open_ticket(string ticket_id)
 {
     try
     {
         TicketsEditView win = new TicketsEditView(ticket_id);
         win.Closed += window_ClosingFinished;
         win.ShowDialog();
     }
     catch (Exception err)
     {
         AppData.MessageService.ShowMessage(err.Message);
     }
 }
        private void OpenNotification()
        {
            Notification.MarkAsSeen(SelectedNotification);

            string[] schStates = { Constants.NF_TYPE_SCHEDULE_VALIDATION_REQUEST,
                                   Constants.NF_TYPE_SCHEDULE_ERRORFIX_REQUEST,
                                   Constants.NF_TYPE_SCHEDULE_ERRORFIX_ESCALATION_REQUEST,
                                   Constants.NF_TYPE_SCHEDULE_RECEIPT_SEND_REQUEST,
                                   Constants.NF_TYPE_SCHEDULE_FILE_DOWNLOAD_REQUEST,
                                   Constants.NF_TYPE_SCHEDULE_FILE_UPLOAD_REQUEST };

            string[] subStates = { Constants.NF_TYPE_SUBSCRIPTION_APPROVAL_REQUEST,
                                   Constants.NF_TYPE_SUBSCRIPTION_APPROVAL_REJECTED };

            if (SelectedNotification != null)
            {
                Console.WriteLine("Opening notification: " + SelectedNotification.notification_type);

                if (SelectedNotification.job_type.Trim().Equals(PetraERP.Shared.Constants.JOB_TYPE_TICKET))
                {
                    crmTicketDetails td = CrmData.get_ticket(SelectedNotification.job_id);

                    try
                    {
                        if (td.status_id == 4) //resolved ticket
                        {
                            AppData.MessageService.ShowMessage("Please note: this ticket has already been resolved.", Shared.UI.MessagingService.DialogType.Message);
                        }

                        TicketsEditView win = new TicketsEditView(td.ticket_id);
                        //win.Closed += window_ClosingFinished;
                        win.ShowDialog();
                    }
                    catch (Exception err)
                    {
                        AppData.MessageService.ShowMessage(err.Message);
                    }
                }

                /*object obj = this.FindName("surrogateFlyout");
                Flyout mflyout = (Flyout)obj;
                mflyout.ClosingFinished += notificationflyout_ClosingFinished;

                if (schStates.Contains(SelectedNotification.notification_type.Trim()))
                {
                    mflyout.Content = new ScheduleView(SelectedNotification.job_id, true);
                    ShowHideNotificationFlyout(false);
                    mflyout.IsOpen = !mflyout.IsOpen;
                }
                else if (subStates.Contains(SelectedNotification.notification_type.Trim()))
                {
                    string s = (SelectedNotification.notification_type.Trim() == Constants.NF_TYPE_SUBSCRIPTION_APPROVAL_REQUEST)
                        ? Constants.PAYMENT_STATUS_IDENTIFIED : Constants.PAYMENT_STATUS_REJECTED;

                    mflyout.Content = new verifySubscription(s, SelectedNotification.job_id, true);
                    ShowHideNotificationFlyout(false);
                    mflyout.IsOpen = !mflyout.IsOpen;
                }
                 */
            }
        }