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);
        }