示例#1
0
 private void SubWindow_OnLoaded(object sender, RoutedEventArgs e)
 {
     if (openWindow != null)
     {
         openWindow.Close();
     }
     openWindow = this;
 }
示例#2
0
 private void btn_openBrowser_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string    hyperlink = homeLink;
         SubWindow subWindow = new SubWindow();
         subWindow.Show();
         subWindow.webBrowser_.Navigate(hyperlink);
         subWindow.Closed += SubWindow_Closed;
     }
     catch (Exception ex) { }
 }
示例#3
0
        private void addItemToList(string[] checkedList, string n3Content, string name, StackPanel stackPanel, string link = "")
        {
            WrapPanel wrapPanel = new WrapPanel();

            wrapPanel.VerticalAlignment = VerticalAlignment.Center;

            CheckBox checkBox = new CheckBox();

            checkBox.Margin = new Thickness(0, 8, 0, 0);
            checkBox.Tag    = name;
            if (checkedList.Contains(name))
            {
                checkBox.IsChecked = true;
            }

            Label label = new Label();

            label.Content = name;
            label.Tag     = n3Content;
            if (link == "")
            {
                label.MouseUp += (ss, ee) =>
                {
                    string content = label.Tag.ToString();
                    textBlock_rules.Text = content;
                }
            }
            ;
            else
            {
                label.MouseUp += (ss, ee) =>
                {
                    try
                    {
                        string[]  lines     = name.Split('.');
                        string    hyperlink = link + lines[0];
                        SubWindow subWindow = new SubWindow();
                        subWindow.Show();
                        subWindow.webBrowser_.Navigate(hyperlink);
                        subWindow.Closed += SubWindow_Closed;
                    }
                    catch (Exception ex) { }
                }
            };

            wrapPanel.Children.Add(checkBox);
            wrapPanel.Children.Add(label);

            stackPanel.Children.Add(wrapPanel);
        }