コード例 #1
0
ファイル: MainWindow.cs プロジェクト: DimonLuk/kursach2
 public void BuildGraph()
 {
     try
     {
         if (_ways_stops_container != null)
         {
             foreach (VBox b in _ways_stops_container)
             {
                 way_container.Remove(b);
             }
         }
         _ways_stops_container    = new List <VBox>();
         _ways_container          = new List <CustomGtkEntry>();
         _stop_time_container     = new List <CustomGtkEntry>();
         _stop_title_container    = new List <CustomGtkEntry>();
         _stop_position_container = new List <CustomGtkEntry>();
         graph = Graph.Deserialize(Path_);
         ShowWays(graph);
         this.Child.ShowAll();
     }
     catch (FileNotFoundException)
     {
         var w = new KursachAttemp2.View.FileNotFoundDialog(this);
         w.Show();
     }
 }
コード例 #2
0
ファイル: FindPathWindow.cs プロジェクト: DimonLuk/kursach2
        protected void OnButtonFindClickedHanlder(object sender, EventArgs e)
        {
            string startTitle = start_postion_title.Text;
            string stopTitle  = stop_position_title.Text;

            if (startTitle == "" || stopTitle == "")
            {
                var w = new FileNotFoundDialog(_parent, () => { }, "Please fill all fields");
            }
            _parent.Graph.BuildMatrix();
            switch (type_of_search.Active)
            {
            case 0:
            {
                _parent.Graph.WayBetween(startTitle, stopTitle);
                break;
            }

            case 1:
            {
                _parent.Graph.WayBetween(startTitle, stopTitle, false);
                break;
            }
            }
            if (_control_container != null)
            {
                foreach (VBox v in _control_container)
                {
                    path_main_container.Remove(v);
                }
            }
            _control_container = new List <VBox>();
            try
            {
                _parent.Graph.CountChanges(ShowPath);
                int numOfChanges = -1;
                if (num_of_changes_entry.Text != "")
                {
                    numOfChanges = Convert.ToInt32(num_of_changes_entry.Text);
                    if (numOfChanges <= _parent.Graph.Changes)
                    {
                        (new FileNotFoundDialog(_parent, () => {}, "Too much changes on the way", "Bad way")).Show();
                    }
                }
            }
            catch (NoWayException)
            {
                (new FileNotFoundDialog(_parent, () => { }, "No way", "No way")).Show();
            }
            catch (FormatException)
            {}
            Child.ShowAll();
        }