예제 #1
0
    protected void ShowWays(Graph g)
    {
        int counter = 0;

        foreach (Way w in g.Ways)
        {
            var builder = new StringBuilder();
            builder.Append("way_");
            builder.Append(counter);


            var tmp_way_title = new Label();
            tmp_way_title.Name      = "way_title";
            tmp_way_title.LabelProp = "Way title:";

            var tmp_way_title_value = new CustomGtkEntry(counter, 0, "way");
            tmp_way_title_value.Name     = "way_title_value";
            tmp_way_title_value.Text     = w.Title;
            tmp_way_title_value.Changed += DataBinding;
            _ways_container.Add(tmp_way_title_value);

            /*var tmp_way_start_time = new global::Gtk.Label();
             * tmp_way_start_time.Name = "way_start_time";
             * tmp_way_start_time.LabelProp = global::Mono.Unix.Catalog.GetString("Sarts at");
             *
             * var tmp_way_start_time_value = new Label;
             * tmp_way_start_time_value.Name = "way_start_time_value";
             * tmp_way_start_time_value.LabelProp = global::Mono.Unix.Catalog.GetString(w[0].StartTimeString);*/

            builder = new StringBuilder();
            builder.Append("hbox_");
            builder.Append(counter);

            var delete_way_button = new CustomGtkButton(counter, 0, "way");
            delete_way_button.Label    = "Delete";
            delete_way_button.Clicked += WayOrStopDeleting;

            var tmp_hbox1_way_info_container = new HBox();
            tmp_hbox1_way_info_container.Name    = builder.ToString();
            tmp_hbox1_way_info_container.Spacing = 6;
            tmp_hbox1_way_info_container.Add(tmp_way_title);
            tmp_hbox1_way_info_container.Add(tmp_way_title_value);
            tmp_hbox1_way_info_container.Add(delete_way_button);
            //tmp_hbox1_way_info_container.Add(tmp_way_start_time);
            //tmp_hbox1_way_info_container.Add(tmp_way_start_time_value);


            var tmp_way_container = new VBox();//Local container
            tmp_way_container.Name    = "vbox4";
            tmp_way_container.Spacing = 6;

            tmp_way_container.Add(tmp_hbox1_way_info_container);

            var tmp_main_container = new VBox();//Local container
            tmp_main_container.Name    = "main_way_stop_info_container";
            tmp_main_container.Spacing = 6;

            tmp_main_container.Add(tmp_way_container);
            ShowStops(w, tmp_main_container, counter);
            _ways_stops_container.Add(tmp_main_container);

            way_container.Add(tmp_main_container);
            counter++;
        }
    }
예제 #2
0
    protected void ShowStops(Way w, VBox vBox, int wayIndex)
    {
        int counter = 0;
        var t1      = new Label();

        t1.Name      = "stop_title_value";
        t1.LabelProp = "Stop name";

        var t2 = new Label();

        t2.Name      = "stop_time_value";
        t2.LabelProp = "Arrive time DD:HH:MM";

        var t2_1 = new Label();

        t2.Name      = "stop_time_value";
        t2.LabelProp = "Position";

        var t3 = new HBox();

        t3.Name    = "table_head";
        t3.Spacing = 6;
        t3.Add(t1);
        t3.Add(t2);
        t3.Add(t2_1);
        vBox.Add(t3);
        foreach (Stop s in w)
        {
            var builder = new StringBuilder();
            builder.Append("stop_");
            builder.Append(counter);


            var tmp_way_title = new CustomGtkEntry(wayIndex, counter, "stopTitle");
            tmp_way_title.Name     = "stop_title_value";
            tmp_way_title.Text     = s.Title;
            tmp_way_title.Changed += DataBinding;
            _stop_title_container.Add(tmp_way_title);

            var tmp_stop_time = new CustomGtkEntry(wayIndex, counter, "stopTime");
            tmp_stop_time.Name     = "stop_time_value";
            tmp_stop_time.Text     = s.StartTimeString;
            tmp_stop_time.Changed += DataBinding;
            _stop_time_container.Add(tmp_stop_time);

            var tmp_stop_position = new CustomGtkEntry(wayIndex, counter, "stopPosition");
            tmp_stop_position.Name     = "stop_time_value";
            tmp_stop_position.Text     = s.Position.ToString();
            tmp_stop_position.Changed += DataBinding;
            _stop_position_container.Add(tmp_stop_position);

            builder = new StringBuilder();
            builder.Append("hbox_stop_");
            builder.Append(counter);

            var delete_stop_button = new CustomGtkButton(wayIndex, counter, "stop");
            delete_stop_button.Label    = "Delete stop";
            delete_stop_button.Clicked += WayOrStopDeleting;

            var tmp_hbox1_stop_info_container = new HBox();
            tmp_hbox1_stop_info_container.Name    = builder.ToString();
            tmp_hbox1_stop_info_container.Spacing = 6;
            tmp_hbox1_stop_info_container.Add(tmp_way_title);
            tmp_hbox1_stop_info_container.Add(tmp_stop_time);
            tmp_hbox1_stop_info_container.Add(tmp_stop_position);
            tmp_hbox1_stop_info_container.Add(delete_stop_button);

            vBox.Add(tmp_hbox1_stop_info_container);

            counter++;
        }
        var add_stop_title = new CustomGtkEntry(wayIndex, counter, "stopTitle");

        var add_stop_time = new CustomGtkEntry(wayIndex, counter, "stopTitle");

        var add_stop_position = new CustomGtkEntry(wayIndex, counter, "stopTitle");

        var add_stop_button = new CustomGtkButton(wayIndex, counter, "addStop", add_stop_title, add_stop_time, add_stop_position);

        add_stop_button.Label    = "Add stop";
        add_stop_button.Clicked += AddStopHandler;
        var hBox = new HBox();

        hBox.Add(add_stop_title);
        hBox.Add(add_stop_time);
        hBox.Add(add_stop_position);
        hBox.Add(add_stop_button);
        vBox.Add(hBox);
    }