private void Key_Click(object sender, RoutedEventArgs e)
        {
            CheckControl c = (CheckControl)sender;

            c.IsChecked = !c.IsChecked;
            foreach (var item in items)
            {
                if (item.Key == c)
                {
                    if (c.IsChecked)
                    {
                        item.Value.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        item.Value.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    item.Key.IsChecked    = false;
                    item.Value.Visibility = Visibility.Collapsed;
                }
            }
        }
Esempio n. 2
0
        public void Setup()
        {
            checkControl = new CheckControl();
            var elements = new[]
            {
                "Element 1",
                "Element 2",
                "Element 3"
            };
            checkControl.AddElements(elements);
            elementTotalCount = elements.Length;

            form = new Form();
            form.Controls.Add(checkControl);
            form.Visible = true;
        }
Esempio n. 3
0
        private void GenerateStructure()
        {
            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(ClassName))
            {
                HtmlTableRow tr = new HtmlTableRow();

                HtmlTableCell td   = new HtmlTableCell();
                CheckControl  ctrl = (CheckControl)LoadControl("~/Apps/Common/Design/CheckControl.ascx");
                ctrl.Text = CHelper.GetResFileString(right.FriendlyName);

                td.Controls.Add(ctrl);
                tr.Cells.Add(td);
                tblRights.Rows.Add(tr);

                checkControls.Add(ctrl);
                rights.Add(right.RightName);
            }
        }
Esempio n. 4
0
        private void GenerateStructure()
        {
            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(ClassName))
            {
                // Check for Class Right (ex. Create)
                bool   isClassRight = false;
                string rightUid     = right.BaseRightUid.ToString();
                foreach (CustomTableRow r in classRights)
                {
                    if (r["BaseRightUid"].ToString() == rightUid)
                    {
                        isClassRight = true;
                        break;
                    }
                }
                if (isClassRight)
                {
                    continue;
                }

                // adding rows
                HtmlTableRow tr = new HtmlTableRow();

                HtmlTableCell td   = new HtmlTableCell();
                CheckControl  ctrl = (CheckControl)LoadControl("~/Apps/Common/Design/CheckControl.ascx");
                ctrl.Text = CHelper.GetResFileString(right.FriendlyName);

                td.Controls.Add(ctrl);
                tr.Cells.Add(td);
                tblRights.Rows.Add(tr);

                checkControls.Add(ctrl);
                rights.Add(right.RightName);
            }
        }
        private void GenerateStructure()
        {
            MetaObject mo        = StateMachineManager.GetState(ClassName, StateId);
            string     fromState = mo.Properties["Name"].Value.ToString();

            foreach (State state in sm.States)
            {
                StateTransition st = sm.FindTransition(fromState, state.Name);
                if (st != null)
                {
                    HtmlTableRow  tr   = new HtmlTableRow();
                    HtmlTableCell td   = new HtmlTableCell();
                    CheckControl  ctrl = (CheckControl)LoadControl("~/Apps/Common/Design/CheckControl.ascx");
                    ctrl.Text = CHelper.GetResFileString(st.Name);

                    td.Controls.Add(ctrl);
                    tr.Cells.Add(td);
                    tblRights.Rows.Add(tr);

                    checkControls.Add(ctrl);
                    states.Add(state.Name);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///   Добавление контакта из строки контакта
        /// </summary>
        /// <param name="dr"> строка таблицы контакта </param>
        /// <param name="check"> Помечать или нет </param>
        private void AddContact(DataRow dr, bool check = false, string phoneNumber = null)
        {
            var cont = new CheckControl();
            var id   = (int)dr[Environment.FaxRecipientData.IDField];

            cont.Name           += id.ToString();
            cont.Collection      = Collection;
            cont.EditPush       += cont_EditPush;
            cont.CheckedChanged += new EventHandler(cont_CheckedChanged);
            if (!(dr[Environment.FaxRecipientData.PersonLinkIDField] is DBNull))
            {
                KeyValuePair <int, string> res = Environment.PersonLinkData.GetFormatedLink((int)dr[Environment.FaxRecipientData.PersonLinkIDField], PersonID);
                cont.InsertLink(res.Value, Environment.PersonURL + res.Key.ToString());
                cont.SelectedText = ": ";
            }
            if (!(dr[Environment.FaxRecipientData.DescriptionField] is DBNull) &&
                !string.IsNullOrEmpty(dr[Environment.FaxRecipientData.DescriptionField].ToString()))
            {
                cont.SelectedText = dr[Environment.FaxRecipientData.DescriptionField] + " ";
            }
            cont.InsertLink(dr[Environment.FaxRecipientData.ContactField].ToString(), "#Edit", cont.Text.Length);


            cont.Tag = dr;
            cont.ID  = id;
            Collection.Add(cont);
            if (!check && dr[Environment.FaxRecipientData.ContactField].ToString().Equals(phoneNumber))
            {
                cont.Checked = true;
            }
            else
            {
                cont.Checked = check;
            }
            cont.ShowEdit = true;
        }
Esempio n. 7
0
        protected override Control CreateControl()
        {
            CheckControl c = new CheckControl();

            return(c);
        }
 public CheckViewModel(string key, string label, string required, CheckControl control)
     : base(key, label, required, control)
 {
     _control = control;
 }
Esempio n. 9
0
 public void Format_Null_TimeSpans_As_Never()
 {
     Assert.AreEqual("never", CheckControl.FormatForDisplay(null));
 }
Esempio n. 10
0
        public void Format_TimeSpan_Seconds_Minutes_Hours_Days()
        {
            var ts = new TimeSpan(days: 2, hours: 1, minutes: 30, seconds: 5);

            Assert.AreEqual("2d 1h 30m 5s ago", CheckControl.FormatForDisplay(ts));
        }
Esempio n. 11
0
        public void Format_TimeSpan_Seconds_Minutes_Hours()
        {
            var ts = new TimeSpan(hours: 1, minutes: 30, seconds: 0);

            Assert.AreEqual("1h 30m ago", CheckControl.FormatForDisplay(ts));
        }
Esempio n. 12
0
        public void Format_TimeSpan_Seconds_Minutes()
        {
            var ts = new TimeSpan(hours: 0, minutes: 2, seconds: 30);

            Assert.AreEqual("2m 30s ago", CheckControl.FormatForDisplay(ts));
        }
Esempio n. 13
0
        public void Format_Future_TimeSpan_As_Now()
        {
            var ts = new TimeSpan(hours: -1, minutes: 0, seconds: 0);

            Assert.AreEqual("just now", CheckControl.FormatForDisplay(ts));
        }
Esempio n. 14
0
 public void Format_Zero_TimeSpan_As_Now()
 {
     Assert.AreEqual("just now", CheckControl.FormatForDisplay(TimeSpan.Zero));
 }