Interaction logic for image_frame.xaml
Inheritance: System.Windows.Controls.UserControl
 public static void close_window(image_frame frame)
 {
     image_frames.Remove(frame);
     main_canvas.Children.Remove(frame);
 }
        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);
        }