Ejemplo n.º 1
0
        public void SetWebElement(WebElementInfo webElement)
        {
            WebElement = webElement;

            NameTextBox.Text             = webElement.Name;
            DescriptionTextBox.Text      = webElement.Description;
            IsRelativeCheckBox.IsChecked = webElement.WebLocator.IsRelative;
            LocatorValueTextBox.Text     = webElement.WebLocator.LocatorValue;
            IsKeyCheckbox.IsChecked      = webElement.IsKeyElement;
            foreach (var item in LocatorTypeComboBox.Items)
            {
                if ((item as ComboBoxItem).Content.ToString() == webElement.WebLocator.LocatorType.ToString())
                {
                    LocatorTypeComboBox.SelectedItem = item;
                }
            }

            TagsControl.SetTags(webElement.Tags);
        }
Ejemplo n.º 2
0
        public MainWindowDataContext()
        {
            _tags = new Resources.Tags();

            var modalWidowDataContext = new ModalWindowsDataContext();

            ModalWindow = new ModalWindow(modalWidowDataContext);


            smartThoughts = new ObservableCollection <SmartThought>(SmartThoughts.GetAll());

            usedTags = new List <string>();

            var tagsControlDataContext = new TagsControlDataContext(_tags);

            TagsControl = new TagsControl(tagsControlDataContext);



            var smartThoughtsEditorControlDataContext = new SmartThoughtsEditorControlDataContext(st =>
            {
                SmartThoughts.Upsert(st);
            }, _tags);

            smartThoughtsEditorControl = new SmartThoughtsEditorControl(smartThoughtsEditorControlDataContext);


            var smartThoughtsPreviewControlDataContext = new SmartThoughtsPreviewControlDataContext(smartThoughts);

            smartThoughtsPreviewControl = new SmartThoughtsPreviewControl(smartThoughtsPreviewControlDataContext);

            MainContent = smartThoughtsPreviewControl;

            smartThoughtsPreviewControlDataContext.SmartThoughtSelected += (s, a) =>
            {
                smartThoughtsEditorControlDataContext.Load(a);
                MainContent = smartThoughtsEditorControl;

                ShouldTagsBeShown = false;
            };

            smartThoughtsEditorControlDataContext.CloseRequired += (s, a) =>
            {
                MainContent = smartThoughtsPreviewControl;

                ShouldTagsBeShown = true;

                tagsControlDataContext.RefreshTags();
            };
            smartThoughtsEditorControlDataContext.SmartThoughtTagEditRequired += (s, a) =>
            {
                modalWidowDataContext.ShowModalContent(a);
            };

            smartThoughtsEditorControlDataContext.SmartThoughtTagCloseRequired += (s, a) =>
            {
                modalWidowDataContext.HideModal();
            };

            tagsControlDataContext.TagSelected += (s, a) =>
            {
                usedTags.Add(a);
                var st = SmartThoughts.GetByTags(usedTags);

                smartThoughts.Clear();

                foreach (var smartThought in st)
                {
                    smartThoughts.Add(smartThought);
                }
            };

            tagsControlDataContext.TagRemoved += (s, a) =>
            {
                usedTags.Remove(a);

                smartThoughts.Clear();

                IList <SmartThought> st = new List <SmartThought>();

                if (usedTags.Any())
                {
                    st = SmartThoughts.GetByTags(usedTags);
                }
                else
                {
                    st = SmartThoughts.GetAll();
                }

                foreach (var smartThought in st)
                {
                    smartThoughts.Add(smartThought);
                }
            };
        }