Exemplo n.º 1
0
        public async void EditCompanyHistory(long HistoryID = 0)
        {
            var newHistoryDialog = new HistoryDialog(); //Create new input dialog

            if (HistoryID != 0)
            {
                selectedCompanyHistory = DataAccessLayer.getCompanyHistoryByID(HistoryID); //Get company history
                newHistoryDialog.SecondaryButtonText = "Delete";                           //Set secondary option
            }
            else
            {
                selectedCompanyHistory = new CompanyHistory();            //Create new history
                selectedCompanyHistory.companyHistoryDate = DateTime.Now; //Set date to today
                newHistoryDialog.SecondaryButtonText      = "Cancel";     //Set secondary option
            }

            var result = await newHistoryDialog.ShowAsync();                       //Show dialog & await result

            if (result == ContentDialogResult.Primary)                             //If primary option chosen
            {
                var item = newHistoryDialog.Content;                               //Get user input
                selectedCompanyHistory.companyHistoryDetails = item.ToString();    //Convert to string
                selectedCompanyHistory.companyID             = selectedCompany.ID; //Attribute company
                DataAccessLayer.saveHistory(selectedCompanyHistory);               //Save history
                GetHistory(selectedCompany.ID);                                    //Refresh history
            }
            else if (result == ContentDialogResult.Secondary)                      //If secondary option chosen
            {
                if (HistoryID != 0)
                {
                    DataAccessLayer.deleteHistory(selectedCompanyHistory);
                    GetHistory(selectedCompany.ID); //Refresh history
                }
            }
        }
Exemplo n.º 2
0
        private void OnHistoryClick(object sender, System.Windows.RoutedEventArgs e)
        {
            Log.WriteLine("Opening history dialog...", LogType.Debug);

            HistoryDialog dialog = new HistoryDialog(m_account)
            {
                Owner = this
            };

            dialog.ShowDialog();
        }
Exemplo n.º 3
0
        private static void OnShowHistory(NotificationMessageWithCallback message)
        {
            //hack, target should not be used this way
            var dialog = new HistoryDialog {
                DataContext = message.Target
            };

            var messageBoxResult = dialog.ShowDialog();

            if (messageBoxResult == true)
            {
                message.Execute(true);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 查看历史消息
        /// </summary>
        private void showHistory()
        {
            var dialog = new HistoryDialog(target);

            dialog.ShowDialog();
        }
Exemplo n.º 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            HistoryDialog dlg = new HistoryDialog();

            dlg.Show();
        }