private void ResetData() { MessageBoxResult result = CustomMessageBox.Show(Properties.Resources.Message_ResetData, Properties.Resources.Warning, MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { if (InI.PanelsFileExist()) { File.Delete(@"panels.ini"); } if (Directory.Exists(Directory.GetCurrentDirectory() + @"\pictures")) { Directory.Delete(Directory.GetCurrentDirectory() + @"\pictures", true); } if (InI.FiltersFileExist()) { File.Delete(@"filters.ini"); } if (InI.ScriptsFileExist()) { File.Delete(@"scripts.ini"); } _ResetSettings(); Settings.ResetData(); AnimationEffect(); } }
private void _webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { navigating = false; if (_uri != _webBrowser.Source && InI.PanelsFileExist()) { if (InI.FiltersFileExist() && !InI.filtersFile.SectionExists("Update")) { InI.filtersFile.Write("Update", "ExcludeUpdate", "true"); InI.filtersFile.Write("Update", "HideOnStartUp", "false"); (mPage as MainPage).filterList.Add("Update"); } Array.Resize(ref updateList, updateList.Length + 1); updateList[updateList.Length - 1] = panelName; Array.Resize(ref versionList, versionList.Length + 1); versionList[versionList.Length - 1] = InI.panelsFile.Read(panelName, "Version"); if (InI.ScriptsFileExist() && InI.scriptsFile.SectionExists("Scripts") && InI.scriptsFile.KeyExists("Scripts", "Version")) { Array.Resize(ref newVersionList, newVersionList.Length + 1); newVersionList[newVersionList.Length - 1] = Regex.Match(_webBrowser.Source.ToString(), InI.scriptsFile.Read("Scripts", "Version")).Value.Replace("-", ".").TrimStart('.').TrimEnd('.'); } if (!InI.panelsFile.Read(panelName, "Tags").Contains("Update")) { if (!string.IsNullOrWhiteSpace(InI.panelsFile.Read(panelName, "Tags"))) { InI.panelsFile.Write(panelName, "Tags", InI.panelsFile.Read(panelName, "Tags") + ";Update"); } else { InI.panelsFile.Write(panelName, "Tags", InI.panelsFile.Read(panelName, "Tags") + "Update"); } } if (!(((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag).ToString().Contains("Update")) { if (!string.IsNullOrWhiteSpace((((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag).ToString())) { ((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag += ";Update"; } else { ((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag += "Update"; } } } }
private void BTemp_PreviewMouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Middle) { MessageBoxResult result = CustomMessageBox.Show(Properties.Resources.Message_Delete_Item_Begin + "\"" + ((((Button)sender).Parent as StackPanel).Children[1] as TextBlock).Text + "\"" + Properties.Resources.Message_Delete_Item_End, Properties.Resources.Delete, MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { mPage._itemCollection.Remove((((Button)sender).Parent as StackPanel).Parent as ListBoxItem); if (Directory.Exists(@"pictures") && File.Exists(Directory.GetCurrentDirectory() + @"\pictures\" + ((Button)sender).Tag.ToString() + ".png")) { File.Delete(Directory.GetCurrentDirectory() + @"\pictures\" + ((Button)sender).Tag.ToString() + ".png"); } if (InI.PanelsFileExist()) { InI.panelsFile.DeleteSection(((Button)sender).Tag.ToString()); } } } }
private void Initializer() { string[] _tagList = null; bool _found = false; Visibility _visibility = Visibility.Visible; bool _isEnabled = true; // Init _hideList if (InI.FiltersFileExist()) { foreach (var x in InI.filtersFile.ReadSections()) { if (InI.filtersFile.Read(x, "HideOnStartUp") == "true") { Array.Resize(ref _hideList, _hideList.Length + 1); _hideList[_hideList.Length - 1] = x; } } } // Init panels if (InI.PanelsFileExist() && InI.panelsFile.ReadSections() != null) { System.Drawing.Bitmap img; foreach (var x in InI.panelsFile.ReadSections()) { if (File.Exists(Directory.GetCurrentDirectory() + @"\pictures\" + x.Replace(":", "") + ".png")) { using (var bmpTemp = new System.Drawing.Bitmap(Directory.GetCurrentDirectory() + @"\pictures\" + x.Replace(":", "") + ".png")) { img = new System.Drawing.Bitmap(bmpTemp); } } else { img = null; } _tagList = InI.panelsFile.Read(x, "Tags").Split(';'); if (InI.FiltersFileExist()) { if (_hideList.Length < _tagList.Length) { foreach (var y in _hideList) { foreach (var z in _tagList) { if (y == z) { _found = true; break; } } } } else { foreach (var y in _tagList) { foreach (var z in _hideList) { if (y == z) { _found = true; break; } } } } } if (_found) { _visibility = Visibility.Collapsed; _isEnabled = false; } else { _visibility = Visibility.Visible; _isEnabled = true; } _found = false; NewPanel(x, InI.panelsFile.Read(x, "Tags"), img, _visibility, _isEnabled); } } }
private void Update() { ((MainWindow)Application.Current.MainWindow).oL.Visibility = Visibility.Visible; ((MainWindow)Application.Current.MainWindow).oLText.Text = Properties.Resources.Message_Updating; if (InI.PanelsFileExist()) { _webBrowser = new WebBrowser(); _webBrowser.Navigated += _webBrowser_Navigated; var _excludeList = new string[] { }; if (InI.FiltersFileExist()) { foreach (var x in InI.filtersFile.ReadSections()) { if (InI.filtersFile.Read(x, "ExcludeUpdate") == "true") { Array.Resize(ref _excludeList, _excludeList.Length + 1); _excludeList[_excludeList.Length - 1] = x; } } } foreach (var x in (mPage as MainPage)._itemCollection.OfType <ListBoxItem>()) { if (InI.panelsFile.SectionExists( ((x.Content as StackPanel).Children[0] as Button).Tag.ToString())) { if (!_excludeList.Intersect( InI.panelsFile.Read( ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Tags") .Split(';')).Any() && Uri.IsWellFormedUriString( InI.panelsFile.Read( ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Site"), UriKind.Absolute)) { panelName = ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(); panelUpdatedIndex = mPage.mainLB.Items.IndexOf(x); navigating = true; _uri = new Uri(InI.panelsFile.Read( ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Site")); _webBrowser.Navigate(_uri); while (navigating) { Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { })); } } } } _excludeList = null; _webBrowser = null; ((MainWindow)Application.Current.MainWindow).oLText.Text = ""; #region Creating the expander var _nSP = new StackPanel(); _nSP.Children.Add(new TextBlock { Text = Properties.Resources.Add_Name, TextDecorations = TextDecorations.Underline, Margin = new Thickness(0, 0, 20, 0) }); _nSP.Children.Add(new TextBlock { Text = string.Join("\n", updateList), Margin = new Thickness(0, 0, 20, 0) }); var _vSP = new StackPanel(); _vSP.Children.Add(new TextBlock { Text = Properties.Resources.Update_Current_Version, TextDecorations = TextDecorations.Underline, Margin = new Thickness(0, 0, 20, 0) }); _vSP.Children.Add(new TextBlock { Text = string.Join("\n", versionList), Margin = new Thickness(0, 0, 20, 0) }); var _nvSP = new StackPanel(); _nvSP.Children.Add(new TextBlock { Text = Properties.Resources.Update_New_Version, TextDecorations = TextDecorations.Underline, Margin = new Thickness(0, 0, 0, 0) }); _nvSP.Children.Add(new TextBlock { Text = string.Join("\n", newVersionList), Margin = new Thickness(0, 0, 0, 0) }); var _newSP = new StackPanel() { Orientation = Orientation.Horizontal }; _newSP.Children.Add(_nSP); _newSP.Children.Add(_vSP); _newSP.Children.Add(_nvSP); var _expander = new Expander { Content = _newSP, Header = Properties.Resources.Update_Found_Begin + updateList.Length + Properties.Resources.Update_Found_End, Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red) }; #endregion if (updateList.Length > 0) { CustomMessageBox.Show(_expander); } else { CustomMessageBox.Show(Properties.Resources.Message_NoUpdates, Properties.Resources.Warning); } updateList = new string[] { }; versionList = new string[] { }; newVersionList = new string[] { }; ((MainWindow)Application.Current.MainWindow).oL.Visibility = Visibility.Collapsed; } }