Пример #1
0
 private void _Click(object sender, RoutedEventArgs e)
 {
     if (tabTask.IsSelected)
     {
         _grView.GraphIsAcyclic(true);
     }
     else
     {
         _grViewCS.IsConnect(true);
     }
 }
Пример #2
0
        public string test(int algorithm, int destination_algorithm, bool isMessShow)
        {
            if (!_graph_view.GraphIsAcyclic(false) || !_graph_viewCS.IsConnect(false))
            {
                MessageBox.Show("Неможливо побудувати діаграму Ганта");
                return("");
            }
            ClearAll();

            AddVerticalLines(50, 397, 25);
            AddHorizontalLines(_graph_viewCS.TopList.Count);

            Label lbl_Alg = new Label();

            if (algorithm == 2)
            {
                lbl_Alg.Content = _graph_view.Algorithm_2(false, false);
            }
            else if (algorithm == 3)
            {
                lbl_Alg.Content = _graph_view.Algorithm_3(false, false);
            }
            else if (algorithm == 12)
            {
                lbl_Alg.Content = _graph_view.Algorithm_12(false, false);
            }

            canvas.Children.Add(lbl_Alg);
            Canvas.SetLeft(lbl_Alg, 20);

            status = new bool[_graph_view.TopList.Count];
            for (int i = 0; i < _graph_view.TopList.Count; i++)
            {
                TopListNew.Add(_graph_view.TopList[_graph_view.idListAlgorithm[i]]);
                status[i] = false;
            }

            List <int> Tkri = new List <int>();

            for (int i = 0; i < _graph_view.TopList.Count; i++)
            {
                _graph_view.NodeIsAcyclic(i, 2, false);
                Tkri.Add(_graph_view.CriticalPath(i, 3));
            }

            Tkr = Tkri.Max();

            Planning(destination_algorithm);
            string str = T_End();

            stopWatch.Stop();
            TimeSpan ts = stopWatch.Elapsed;

            time = String.Format("{0:00}год, {1:00}хв, {2:00}с, {3:00}мс", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
            Time = ts.Hours * 3600 + ts.Minutes * 60 + ts.Seconds + Convert.ToDouble(ts.Milliseconds) / 1000;
            str += "\nЧас роботи алгоритму:\n" + time;
            if (isMessShow)
            {
                MessageBox.Show(str + "\n" + Time, "Алгоритм " + algorithm + " Призначення " + destination_algorithm);
            }

            string str0 = "Алгоритм " + algorithm + "\tПризначення " + destination_algorithm + "\n" + str +
                          "\n\n*********************************************************\n\n";

            return(str0);
        }