Esempio n. 1
0
        public ProgramControl(Program prog, CategoryModel Categories)
        {
            InitializeComponent();

            chkNotify.Content = Translate.fmt("lbl_notify");
            btnAdd.Content    = Translate.fmt("lbl_add");
            btnSplit.Content  = Translate.fmt("lbl_split");
            btnRemove.Content = Translate.fmt("lbl_remove");

            progGrid.Columns[1].Header = Translate.fmt("lbl_name");
            progGrid.Columns[2].Header = Translate.fmt("lbl_progam");

            SuspendChange++;

            progArea.Visibility = Visibility.Collapsed;

            CatModel = Categories;
            //category.ItemsSource = CatModel.Categorys;
            category.ItemsSource = CatModel.GetCategorys();

            //mBorderBrush = name.BorderBrush;
            //name.BorderBrush = Brushes.Transparent;

            cmbAccess.Items.Add(new ComboBoxItem()
            {
                Content = Translate.fmt("acl_none"), Tag = Program.Config.AccessLevels.Unconfigured
            });
            cmbAccess.Items.Add(new ComboBoxItem()
            {
                Content = Translate.fmt("acl_allow"), Tag = Program.Config.AccessLevels.FullAccess
            });
            cmbAccess.Items.Add(new ComboBoxItem()
            {
                Content = Translate.fmt("acl_edit"), Tag = Program.Config.AccessLevels.CustomConfig
            });
            cmbAccess.Items.Add(new ComboBoxItem()
            {
                Content = Translate.fmt("acl_lan"), Tag = Program.Config.AccessLevels.LocalOnly
            });
            cmbAccess.Items.Add(new ComboBoxItem()
            {
                Content = Translate.fmt("acl_block"), Tag = Program.Config.AccessLevels.BlockAccess
            });
            foreach (ComboBoxItem item in cmbAccess.Items)
            {
                item.Background = GetAccessColor((Program.Config.AccessLevels)item.Tag);
            }

            SuspendChange--;

            Program = prog;

            DoUpdate();

            ProgramList.ID id = prog.IDs.First();
            if (id.Type == ProgramList.Types.Global || id.Type == ProgramList.Types.System)
            {
                btnIDs.IsEnabled = false;
                //btnCustimize.Visibility = Visibility.Hidden;
                cmbAccess.Visibility = Visibility.Hidden;
                //category.Visibility = Visibility.Hidden;
            }
            if (id.Type == ProgramList.Types.Global)
            {
                chkNotify.Visibility = Visibility.Hidden;
            }

            rect.MouseDown += new MouseButtonEventHandler(rect_Click);
            //name.MouseDown += new MouseButtonEventHandler(rect_Click);
            name.PreviewMouseDown += new MouseButtonEventHandler(rect_Click);
            //progGrid.PreviewMouseDown += new MouseButtonEventHandler(rect_Click);
            icon.MouseDown += new MouseButtonEventHandler(rect_Click);
            info.MouseDown += new MouseButtonEventHandler(rect_Click);

            category.PreviewMouseWheel += ctrl_PreviewMouseWheel;
            //progGrid.PreviewMouseWheel += ctrl_PreviewMouseWheel;
        }