Esempio n. 1
0
        private void lstBoxTriggers_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var selected = lstBoxTriggers.SelectedItem;

            if (selected is Trigger)
            {
                TriggerEdit ed = new TriggerEdit();
                ed.ShowEditTrigger(selected as Trigger);
            }
        }
Esempio n. 2
0
        private void contextEditTrigger_Click(object sender, RoutedEventArgs e)
        {
            var selected = lstBoxTriggers.SelectedItem;

            if (selected is Trigger)
            {
                TriggerEdit ed = new TriggerEdit();
                ed.ShowEditTrigger(selected as Trigger);
            }
        }
Esempio n. 3
0
        private void btnAddCode_Click(object sender, RoutedEventArgs e)
        {
            TriggerEdit ed   = new TriggerEdit();
            var         item = lstBoxTriggers.SelectedItem;

            if (item is TriggerList)
            {
                ed.ShowNewTrigger(item as TriggerList);
                lstBoxTriggers.Items.Refresh();

                foreach (var it in lstBoxTriggers.Items)
                {
                    if (it is TriggerList)
                    {
                        TriggerList item2 = item as TriggerList;
                        TriggerList bg34  = it as TriggerList;
                        if (item2.DisplayName == bg34.DisplayName)
                        {
                            item2.IsExpanded = true;
                        }
                    }
                }
            }
            else
            {
                //trying to get parent itemlist
                TriggerList trytofind = DataQuery.Instance.FindParentList(item as Trigger);
                if (trytofind != null)
                {
                    ed.ShowNewTrigger(trytofind);
                }
                else
                {
                    ed.ShowNewTrigger();
                }

                lstBoxTriggers.Items.Refresh();

                foreach (var it in lstBoxTriggers.Items)
                {
                    if (it is TriggerList)
                    {
                        TriggerList bg34 = it as TriggerList;
                        if (trytofind.DisplayName == bg34.DisplayName)
                        {
                            bg34.IsExpanded = true;
                        }
                    }
                }
            }

            //Refresh gui
            //http://stackoverflow.com/questions/11540459/create-refresh-a-wpf-treeview-and-remember-expanded-nodes-without-xaml
            //lstBoxTriggers.UpdateLayout();
        }