private void Sure_Click(object sender, RoutedEventArgs e) { string[] CloseMg = new string[2] { "Mini", "false" }; if (MiniButton.IsChecked == true) { CloseMg[0] = "Mini"; } else { CloseMg[0] = "Exit"; } if (checkBox.IsChecked == true) { CloseMg[1] = "true"; } if (!MyXml.FindNode("Close")) { MyXml.InsertNode("CloseStyle", CloseMg[0], 1, "Close", "Main"); //MyXml.InsertNode("CloseStyle",CloseMg[0], 1); MyXml.InsertNode("CloseShow", CloseMg[1], 2, "Close"); } else { MyXml.ChangeNode("CloseStyle", CloseMg[0], "Close"); MyXml.ChangeNode("CloseShow", CloseMg[1], "Close"); } this.Close(); }
private void Close_Click(object sender, RoutedEventArgs e) { if (MyXml.GetXmlValue("CloseShow") == "true") { if (MyXml.GetXmlValue("CloseStyle") == "Mini") { this.ShowInTaskbar = false; this.Visibility = Visibility.Collapsed; } else { this.notifyIcon.Visible = false; this.Close(); } } else { Ask ask = new Ask(); ask.ShowDialog(); if (MyXml.GetXmlValue("CloseStyle") == "Mini") { this.ShowInTaskbar = false; this.Visibility = Visibility.Collapsed; } else { this.notifyIcon.Visible = false; this.Close(); } } //this.Close(); //this.ShowInTaskbar = false; //this.Visibility = Visibility.Collapsed; }
public MainWindow() { InitializeComponent(); InitNotifyIcon(); this.SourceInitialized += delegate(object sender, EventArgs e) { this._HwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; }; StartAutomaticallyCreate("StickyNote"); this.MouseMove += new MouseEventHandler(Window_MouseMove); this.Topmost = true; if (this.Topmost == true) { Pin.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(169, 170, 170)); Pin.ToolTip = "取消置顶"; } if (!System.IO.File.Exists(MyXml.XMLPATH)) { // 填入 API Key 和 Secret Key MyXml.CreateXml("API Key", "Secret Key"); } }
public static string EnterString = " "; // 定义换行文本 /// <summary> /// 更新API Key Secret Key /// </summary> public static void Update() { clientId = MyXml.GetXmlValue("API_Key"); clientSecret = MyXml.GetXmlValue("Secret_Key"); }