Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                URLGroup.initURLs();
                addURLsInToolBar();
            }
            catch (FileNotFoundException e)
            {
                if (MessageBox.Show("Файл с разметкой ссылок не найден. Создать?", "Ошибка", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    try
                    {
                        File.WriteAllText(URLGroup.FileName, MTemplate);
                        URLGroup.initURLs();
                        addURLsInToolBar();
                    }
                    catch (IOException exp)
                    {
                        MessageBox.Show(exp.Message);
                    }
                }
            }
            catch (XmlException e)
            {
                MessageBox.Show(e.Message);
            }

            URLGroup.onURLsUpdate      += changeButtonName;
            URLGroup.onCloseEditWindow += setEnableToolBar;
            URLGroup.onSaveAndGo       += browserNavigate;
        }
Esempio n. 2
0
        private void saveActiveURL()
        {
            URL oldURL = URLGroup.findURL(url => url.isActive);

            URLGroup.updateURL(oldURL, new URL(urlName.Text, urlHref.Text));
            setEnableButtons(false);
        }
Esempio n. 3
0
        public void click(object sender, RoutedEventArgs e)
        {
            Button source  = (Button)e.Source;
            URL    findURL = URLGroup.findURL(url => url.Name == source.Content.ToString());

            browser.Navigate(findURL.Href);
            URLGroup.setActive(findURL);

            if (!refresh.IsEnabled)
            {
                refresh.IsEnabled = true;
            }
        }
Esempio n. 4
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                ExitWindow exit = new ExitWindow();
                exit.Show();
                exit.Owner = this;
            }

            if (e.Key == Key.F1 && URLGroup.isExists(url => url.isActive))
            {
                setEnableToolBar(false);

                URL active = URLGroup.findURL(url => url.isActive);

                EditWindow edit = new EditWindow();
                edit.urlName.Text = active.Name;
                edit.urlHref.Text = active.Href;

                edit.Show();
                edit.Owner = this;
            }
        }
Esempio n. 5
0
        private void browserNavigate()
        {
            URL activeUrl = URLGroup.findURL(url => url.isActive);

            browser.Navigate(activeUrl.Href);
        }