using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using C1.Silverlight;

namespace GaugeBuilder
{
    public partial class CollectionEditorUC : UserControl
    {
        public CollectionEditorUC()
        {
            InitializeComponent();

            btn.Click += new RoutedEventHandler(btn_Click);
            Window = new CollectionWindow();
        }

        public CollectionWindow Window { get; private set; }

        private void btn_Click(object sender, RoutedEventArgs e)
        {
            if (Window.Visibility == Visibility.Visible)
            {
                Window.Closing += new CancelEventHandler(Window_Closing);
                Window.CenterOnScreen();
                Window.ShowModal();
            }
            else
            {
                Window.Visibility = Visibility.Visible;
                Window.Focus();
            }
        }

        void Window_Closing(object sender, CancelEventArgs e)
        {
            e.Cancel = true;
            Window.Hide();
        }
    }
}
