private void RibbonWindow_Closing(object sender, CancelEventArgs e) {
var itemColorSettingsLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"BExplorer\itemcolors.cfg");
var doc = new XmlDocument();
XmlElement elementRoot = doc.CreateElement(string.Empty, "Root", string.Empty);
foreach (var element in this.LVItemsColorCol) {
XmlElement elementRow = doc.CreateElement(string.Empty, "ItemColorRow", string.Empty);
XmlElement elementExtension = doc.CreateElement(string.Empty, "Extensions", string.Empty);
elementExtension.InnerText = element.ExtensionList;
XmlElement elementColor = doc.CreateElement(string.Empty, "Color", string.Empty);
elementColor.InnerText = BitConverter.ToInt32(new byte[] { element.TextColor.A, element.TextColor.R, element.TextColor.G, element.TextColor.B }, 0).ToString();
elementRow.AppendChild(elementExtension);
elementRow.AppendChild(elementColor);
elementRoot.AppendChild(elementRow);
}
doc.AppendChild(elementRoot);
doc.Save(itemColorSettingsLocation);
if (this.OwnedWindows.OfType<FileOperationDialog>().Any()) {
if (MessageBox.Show("Are you sure you want to cancel all running file operation tasks?", "", MessageBoxButton.YesNo) == MessageBoxResult.No) {
e.Cancel = true;
return;
}
}
if (this.WindowState != WindowState.Minimized) {
SaveSettings(string.Concat(from item in tcMain.Items.Cast<Wpf.Controls.TabItem>() select ";" + item.ShellObject.ParsingName));
}
this._ShellListView.SaveSettingsToDatabase(this._ShellListView.CurrentFolder);
//SaveHistoryToFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\history.txt", this.bcbc.DropDownItems.OfType<String>().Select(s => s).ToList());
AddToLog("Session Ended");
if (!this.IsMultipleWindowsOpened) {
e.Cancel = true;
App.IsStartMinimized = true;
this.WindowState = WindowState.Minimized;
this.Visibility = Visibility.Hidden;
} else {
beNotifyIcon.Visibility = Visibility.Collapsed;
}
if (!File.Exists("Settings.xml")) new XElement("Settings").Save("Settings.xml");
//var Data = bcbc.DropDownItems;
var Settings = XElement.Load("Settings.xml");
if (Settings.Element("DropDownItems") == null)
Settings.Add(new XElement("DropDownItems"));
else
Settings.Element("DropDownItems").RemoveAll();
foreach (var item in bcbc.DropDownItems.OfType<string>().Reverse().Take(15)) {
Settings.Element("DropDownItems").Add(new XElement("Item", item));
}
//Settings.Save("Settings.xml");
}