initialize_contents() public method

public initialize_contents ( System.Windows.Controls.UserControl uc, Type obj_type, int obj_id, System.Windows.Controls.UserControl parent_frame, double width ) : void
uc System.Windows.Controls.UserControl
obj_type System.Type
obj_id int
parent_frame System.Windows.Controls.UserControl
width double
return void
Esempio n. 1
0
        public static void open_location_collection_window(string location, int location_id, double pos_x, double pos_y)
        {
            if (window_manager.collection_frames.Count + 1 > configurations.max_collection_frame)
                return;

            window_frame frame = new window_frame();
            window_content content = new window_content();
            collection_listbox c_listbox = new collection_listbox();
            c_listbox.parent = frame;
            c_listbox.list_contributions_in_location(location_id);
            //content.initialize_contents(c_listbox);
            content.initialize_contents(c_listbox, Type.GetType("nature_net.Location"), location_id, frame, configurations.frame_title + " in " + location_id.ToString() + ": " + location);
            frame.window_content.Content = content;

            content.list_all_comments();

            window_manager.collection_frames.Add(frame);
            open_window(frame, pos_x - (frame.Width / 2), pos_y - (c_listbox.Height));
            frame.set_title(configurations.frame_title + " in " + location_id.ToString() + ": " + location);
        }
Esempio n. 2
0
        public static void open_design_idea_window_ext(design_ideas_listbox parent, double pos_x, double pos_y)
        {
            if (window_manager.design_ideas_frames.Count + 1 > configurations.max_design_ideas_frame)
                return;

            window_frame frame = new window_frame();
            window_content content = new window_content();
            design_ideas_listbox list = new design_ideas_listbox();
            list.parent = parent;
            content.initialize_contents(list, true, frame);
            frame.window_content.Content = content;

            window_manager.design_ideas_frames.Add(frame);
            open_window(frame, pos_x, pos_y);
            frame.hide_change_view();
            frame.set_title("Submit Design Idea");
        }
Esempio n. 3
0
        public static void open_design_idea_window(string[] idea_item, double pos_x, double pos_y, string title = "Design Idea")
        {
            if (window_manager.design_ideas_frames.Count + 1 > configurations.max_design_ideas_frame)
                return;

            window_frame frame = new window_frame();
            window_content content = new window_content();

            item_generic_v2 i = new item_generic_v2();
            i.title.Text = idea_item[3]; i.description.Visibility = Visibility.Collapsed;
            i.title.FontSize = 17;
            i.user_info.Margin = new Thickness(5);
            i.user_info_name.Text = idea_item[5]; i.user_info_date.Text = idea_item[4];
            i.user_info_name.Margin = new Thickness(2, 0, 0, 0); i.user_info_date.Margin = new Thickness(2, 0, 2, 0);
            i.user_info_name.FontSize = 10; i.user_info_date.FontSize = 10;
            i.user_info_icon.Source = new BitmapImage(new Uri(idea_item[2])); i.number.Text = idea_item[7]; i.number_icon.Visibility = Visibility.Collapsed;
            i.txt_level1.Text = configurations.designidea_num_desc;
            i.txt_level2.Visibility = Visibility.Collapsed; i.txt_level3.Visibility = Visibility.Collapsed;
            i.avatar.Source = configurations.img_thumbs_up_icon; i.num_likes.Content = idea_item[8]; i.avatar.Tag = i;
            i.avatar.Width = 45; i.avatar.Height = 45; i.avatar.Margin = new Thickness(5);
            i.right_panel.Width = configurations.design_idea_right_panel_width;
            i.set_like_handler();
            i.Tag = idea_item[1]; i.top_value = Convert.ToInt32(idea_item[8]);

            i.Background = new SolidColorBrush(Colors.White);
            i.Width = frame.Width;
            content.initialize_contents(i, Type.GetType("nature_net.Contribution"), Convert.ToInt32(idea_item[1]), frame, idea_item[5] + "'s " + title);

            frame.window_content.Content = content;

            window_manager.design_ideas_frames.Add(frame);
            open_window(frame, pos_x, pos_y);
            frame.hide_change_view();
            frame.set_title(idea_item[5] + "'s " + title);
        }
Esempio n. 4
0
        public static void open_contribution_window(collection_item citem, double pos_x, double pos_y, string ctype)
        {
            if (window_manager.image_frames.Count + 1 > configurations.max_image_display_frame)
                return;

            //window_frame frame = new window_frame();
            window_content content = new window_content();
            //contribution_view m = new contribution_view();
            //m.view_contribution(citem);
            image_frame iframe = new image_frame();
            iframe.view_contribution(citem);
            content.initialize_comments(citem._contribution);
            iframe.window_content.Content = content;
            if (!configurations.center_commentarea_and_keyboard)
            {
                iframe.the_content.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                content.center_keyboard = false;
            }
            iframe.UpdateLayout();
            content.initialize_contents(null, Type.GetType("nature_net.Contribution"), citem._contribution.id, iframe, iframe.the_content.Width);
            //frame.window_content.Content = content;
            //window_manager.image_display_frames.Add(frame);
            //open_window(frame, pos_x, pos_y);
            //m.center_image();
            //frame.hide_change_view();
            //frame.set_title(ctype);
            main_canvas.Children.Add(iframe);
            iframe.UpdateLayout();
            window_manager.image_frames.Add(iframe);

            double h = iframe.ActualHeight;
            pos_x = pos_x - (iframe.ActualWidth / 2);
            //try { h = ((window_content)(iframe.window_content.Content)).the_item.ActualHeight; }
            //catch (Exception) { }
            if (pos_y > window_manager.main_canvas.ActualHeight - h)
                pos_y = window_manager.main_canvas.ActualHeight - h;
            TranslateTransform m = new TranslateTransform(pos_x, pos_y);
            Matrix matrix = m.Value;
            iframe.RenderTransform = new MatrixTransform(matrix);
            UpdateZOrder(iframe, true);
        }
Esempio n. 5
0
        public static void open_collection_window(string username, int userid, double pos_x, double pos_y)
        {
            if (window_manager.collection_frames.Count + 1 > configurations.max_collection_frame)
                return;

            window_frame frame = new window_frame();
            window_content content = new window_content();
            collection_listbox c_listbox = new collection_listbox();
            c_listbox.parent = frame;
            c_listbox.list_all_contributions(username);
            content.initialize_contents(c_listbox, Type.GetType("nature_net.User"), userid, frame, username + "'s " + configurations.frame_title);
            frame.window_content.Content = content;
            content.list_all_comments();

            window_manager.collection_frames.Add(frame);
            open_window(frame, pos_x, pos_y);
            frame.set_title(username + "'s " + configurations.frame_title);
        }
Esempio n. 6
0
        public static void open_activity_window(string activity_name, int activity_id, double pos_x, double pos_y)
        {
            if (window_manager.activity_frames.Count + 1 > configurations.max_activity_frame)
                return;

            window_frame frame = new window_frame();
            window_content content = new window_content();
            collection_listbox c_listbox = new collection_listbox();
            c_listbox.parent = frame;
            c_listbox.list_contributions_in_activity(activity_id);
            content.initialize_contents(c_listbox, Type.GetType("nature_net.Activity"), activity_id, frame, activity_name + "'s " + configurations.frame_title);
            frame.window_content.Content = content;
            content.list_all_comments();

            window_manager.activity_frames.Add(frame);
            open_window(frame, pos_x, pos_y);
            string title = activity_name;
            //if (activity_name.Length > configurations.max_activity_frame_title_chars)
            //    title = activity_name.Substring(0, 10) + "...";
            frame.set_title(title + "'s " + configurations.frame_title);
        }