Interaction logic for window_frame.xaml
Наследование: System.Windows.Controls.UserControl
Пример #1
0
 public static void close_window(window_frame frame)
 {
     collection_frames.Remove(frame);
     activity_frames.Remove(frame);
     image_display_frames.Remove(frame);
     design_ideas_frames.Remove(frame);
     main_canvas.Children.Remove(frame);
 }
Пример #2
0
 public static void close_signup_window(window_frame frame, string username)
 {
     signup_frames.Remove(frame);
     main_canvas.Children.Remove(frame);
     highlight_timer = new System.Threading.Timer(new System.Threading.TimerCallback(highlight_callback_users_t), username, 100, System.Threading.Timeout.Infinite);
 }
Пример #3
0
 public static void close_submit_design_idea_window(window_frame frame, string title)
 {
     design_ideas_frames.Remove(frame);
     main_canvas.Children.Remove(frame);
     highlight_timer = new System.Threading.Timer(new System.Threading.TimerCallback(highlight_callback_design_ideas_t), title, 100, System.Threading.Timeout.Infinite);
 }
Пример #4
0
        public static void open_signup_window(double pos_x, double pos_y)
        {
            if (window_manager.signup_frames.Count + 1 > configurations.max_signup_frame)
                return;

            window_frame frame = new window_frame();
            signup s = new signup();
            s.parent = frame;
            s.user_pin.parent = frame;
            s.load_window();
            frame.window_content.Content = s;

            window_manager.signup_frames.Add(frame);
            open_window(frame, pos_x, pos_y);
            frame.hide_change_view();
            frame.set_title("Sign up");
            frame.set_icon(configurations.img_signup_window_icon);
        }
Пример #5
0
        private static void open_window(window_frame frame, double pos_x, double pos_y)
        {
            main_canvas.Children.Add(frame);
            frame.IsManipulationEnabled = true;
            frame.UpdateLayout();

            double h = frame.ActualHeight;
            try { h = ((window_content)(frame.window_content.Content)).the_item.ActualHeight; }
            catch (Exception) { }
            double w = frame.ActualWidth;
            try { w = ((window_content)(frame.window_content.Content)).the_item.ActualWidth; }
            catch (Exception) { }
            if (pos_y > window_manager.main_canvas.ActualHeight - h)
                pos_y = window_manager.main_canvas.ActualHeight - h;
            if (pos_x > window_manager.main_canvas.ActualWidth - w)
                pos_x = window_manager.main_canvas.ActualWidth - w;
            TranslateTransform m = new TranslateTransform(pos_x, pos_y);
            Matrix matrix = m.Value;
            frame.RenderTransform = new MatrixTransform(matrix);
            UpdateZOrder(frame, true);
        }
Пример #6
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);
        }
Пример #7
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");
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }