コード例 #1
0
        ///<summary>
        /// This function is responsible for the activities that are activated at the end of the process
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            int i = 0;

            if (e.Cancelled)
            {
                MessageBox.Show("work cancelled", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
            }


            try
            {
                bl.CreateLine(number, area, stopListInput);

                foreach (var item in stopListInput)
                {
                    bl.CreateLineStation(bl.GetIdByNumber(number), i++, item.StopCode);
                }
                if (stopListInput.Count() > 1)
                {
                    for (i = 1; i < stopListInput.Count(); i++)
                    {
                        // bl.AddStopInLine(bl.GetIdByNumber(number), stopListInput[i - 1].StopCode, i);

                        bl.CreateSequentialStopInfo(stopListInput[i - 1].StopCode, stopListInput[i].StopCode);
                    }
                }
                MessageBoxResult res = MessageBox.Show("Would you like to add another bus in the opposite direction??", "Verification", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (res == MessageBoxResult.No)
                {
                    ;
                }

                else
                {
                    bl.CreateOppositeDirectionLine(number, area, stopListInput);
                }
            }
            catch (BO.BODOBadLineIdException ex)
            {
                MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                worker.RunWorkerAsync(3);
                amount = 0;
                return;
            }
            MessageBox.Show("line added!", "input", MessageBoxButton.OK, MessageBoxImage.Information);
            foreach (Window w in Application.Current.Windows)
            {
                if (w.Name == "PresentationLines1")
                {
                    w.Close();
                }
            }

            new PresentationLines("DRIVER").Show();
            this.Close();
        }