Пример #1
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e) //YouTube
 {
     if (checkBox1.Checked)                                        //go from not checked to checked
     {
         blocked_websites.Add("youtube.com");
     }
     else//going from checked to not checked
     {
         blocked_websites.Remove("youtube.com");
     }
 }
Пример #2
0
        private void MenuItem_OpenRecent_Click(object sender, RoutedEventArgs e)
        {
            var a          = e.OriginalSource.ToString();
            int indexStart = a.IndexOf("Header:") + 7;
            int indexStop  = a.IndexOf("Items") - 1;

            a        = a.Remove(indexStop);
            filePath = a.Substring(indexStart);
            LoadToTextBox(filePath);
            if (propertiesLastFile.Contains(filePath))
            {
                propertiesLastFile.Remove(filePath);
            }
            propertiesLastFile.Insert(0, filePath);
            Properties.Settings.Default.Save();
        }
Пример #3
0
 async void delete_click(object sender, RoutedEventArgs e, string card, string dir)
 {
     MaterialDesignThemes.Wpf.Card actual = (MaterialDesignThemes.Wpf.Card)modpacksListContainer.FindName(card);
     System.Collections.Specialized.StringCollection x = (System.Collections.Specialized.StringCollection)Properties.Settings.Default["bookmarks"];
     foreach (var i in x)
     {
         if (i == dir)
         {
             x.Remove(dir);
             break;
         }
     }
     Properties.Settings.Default.Save();
     try
     {
         if (Directory.Exists(dir))
         {
             Directory.Delete(dir, true);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Cannot delete directory. Try again");
     }
     await modpacksUpdate();
 }
Пример #4
0
        private void DeleteExtensionButton_Click(object sender, RoutedEventArgs e)
        {
            string extensionSelected = FileExtensionListBox.SelectedItem as string;

            Ext.Remove(extensionSelected);
            FileExtensionListBox.ItemsSource = Ext;
            FileExtensionListBox.Items.Refresh();
        }
Пример #5
0
        private async void Page_Loaded(object senderx, RoutedEventArgs ee)
        {
            System.Collections.Specialized.StringCollection x = (System.Collections.Specialized.StringCollection)Properties.Settings.Default["bookmarks"];
            if (x.Count != 0)
            {
                foreach (var i in x)
                {
                    try
                    {
                        var     json    = System.IO.File.ReadAllText(i + "\\" + new DirectoryInfo(i).Name + ".json");
                        dynamic decoded = JsonConvert.DeserializeObject(json);
                        var     card    = new MaterialDesignThemes.Wpf.Card();
                        card.Height = 90;
                        card.Width  = 200;
                        Label lab = new Label();
                        lab.Content    = decoded.instanceName;
                        lab.FontWeight = FontWeights.ExtraBold;
                        Button play = new Button();
                        play.Content    = "Play";
                        play.Foreground = new SolidColorBrush(Colors.White);
                        play.Click     += new RoutedEventHandler((sender, e) => play_click(this, e, i));
                        bookmarksContainer.Children.Add(card);
                        StackPanel panel = new StackPanel();
                        play.Margin             = new Thickness(10, 20, 10, 0);
                        lab.HorizontalAlignment = HorizontalAlignment.Center;
                        panel.Children.Add(lab);
                        panel.Children.Add(play);
                        card.Content = panel;
                    }
                    catch (Exception ex)
                    {
                        x.Remove(i);
                        Label lab = new Label();
                        lab.FontSize = 15;
                        lab.Content  = "An error occurred. We fixed it. Reload this page";
                        bookmarksContainer.Children.Add(lab);
                        break;
                    }
                }
            }
            else
            {
                Label lab = new Label();
                lab.FontSize = 15;
                lab.Content  = "No bookmarks. Go to installed modpacks and bookmark some modpacks there";
                bookmarksContainer.Children.Add(lab);
            }
            transition.SelectedIndex = 1;
            if (Properties.Settings.Default["justUpdated"].ToString() == "true")
            {
                await Task.Delay(400);

                await MaterialDesignThemes.Wpf.DialogHost.Show(new Dialogs.Changelog(), "RootDialog");

                Properties.Settings.Default["justUpdated"] = "false";
                Properties.Settings.Default.Save();
            }
        }
Пример #6
0
 public void SetFavourite(string song, bool isFavorite)
 {
     if (isFavorite)
     {
         if (!_favourites.Contains(song))
         {
             _favourites.Add(song);
         }
     }
     else
     {
         _favourites.Remove(song);
     }
 }
Пример #7
0
        internal static void RemoveFavourCity(string cityID)
        {
            System.Collections.Specialized.StringCollection cities = Properties.app.Default.FavourCityList;
            try
            {
                cities.Remove(cityID);
            }
            catch
            {
                Console.WriteLine("Unable to find the city {0}.", cityID);
            }

            Properties.app.Default.Save();
        }
Пример #8
0
        private void AddNewRecentWorkItems(string subject)
        {
            Helpers.DebugInfo("Updating recent work items: " + subject);

            _RecentWorkItems.Remove(subject);
            _RecentWorkItems.Insert(0, subject);

            while (_RecentWorkItems.Count > 10)
            {
                _RecentWorkItems.RemoveAt(_RecentWorkItems.Count - 1);
            }

            Properties.Settings.Default["RecentWorkItems"] = _RecentWorkItems;
            Properties.Settings.Default.Save();
        }
Пример #9
0
        private void RemoveBtn_Click(object sender, EventArgs e)
        {
            if (ProgramListBox.SelectedIndex < 0)
            {
                return;
            }

            string command = (string)ProgramListBox.SelectedItem;

            System.Collections.Specialized.StringCollection CustomOpens = Properties.CoreSettings.Default.CustomProgramOpens;
            CustomOpens.Remove(command);
            Properties.CoreSettings.Default.CustomProgramOpens = CustomOpens;
            Properties.CoreSettings.Default.Save();
            ProgramOpenManager_Load(this, new EventArgs());
        }
Пример #10
0
        private void checkedListBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if ((e.KeyCode == Keys.Delete) && (checkedListBox.SelectedIndex != -1))
            {
                string       strItem = (string)checkedListBox.SelectedItem;
                DialogResult res     = MessageBox.Show(String.Format("Do you want to delete the following constraint from the list?{0}{0}{1}",
                                                                     Environment.NewLine, strItem), XMLViewForm.cstrCaption, MessageBoxButtons.YesNo);

                if (res == DialogResult.Yes)
                {
                    checkedListBox.Items.Remove(strItem);
                    if (m_astrPreviousConstraints.Contains(strItem))
                    {
                        m_astrPreviousConstraints.Remove(strItem);
                    }
                }
            }
        }
Пример #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            string userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\" + "Синхронизируемая папка";

            if (listFolders.SelectedItem != null)
            {
                if (listFolders.SelectedItem.ToString() != userFolder)
                {
                    folders.Remove(listFolders.SelectedItem.ToString());
                    listFolders.Items.Remove(listFolders.SelectedItem);
                    Properties.Settings.Default.selectedFolders = folders;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    MessageBox.Show("Данную папку нельзя удалить");
                }
            }
        }
Пример #12
0
 private void RemoveFromList(string element)
 {
     try
     {
         System.Collections.Specialized.StringCollection newList = Properties.Settings.Default.ShoppingList;
         if (newList.Contains(element))
         {
             newList.Remove(element);
             Properties.Settings.Default.ShoppingList = newList;
             Properties.Settings.Default.Save();
         }
         else
         {
             SaySomething("Unable to find " + element + " in the current shopping list.");
         }
     }
     catch (Exception ex)
     {
         LogIt("Unable to remove " + element + " from the shopping list." + "/r/nError: " + ex.Message);
     }
 }
 /// <summary>
 /// Add or removes path from the folderList_.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="add"></param>
 protected virtual void ExchangePath(string path, bool add)
 {
     if (add)
     {
         if (!folderList_.Contains(path))
         {
             folderList_.Add(path);
             // notfiy add
             OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Checked));
         }
     }
     else
     {
         if (folderList_.Contains(path))
         {
             folderList_.Remove(path);
             // notfiy remove
             OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Unchecked));
         }
     }
 }
        protected void AddToComboBox(EcTextBox tb, ComboBox cb, System.Collections.Specialized.StringCollection sc)
        {
            string strText = tb.Text;

            if (!String.IsNullOrEmpty(strText))
            {
                if (cb.Items.Contains(strText))
                {
                    cb.Items.Remove(strText);
                }

                cb.Items.Insert(0, strText);

                // also save some in the project config file for later recall
                if (sc.Contains(strText))
                {
                    sc.Remove(strText);
                }

                sc.Insert(0, strText);
            }
        }
Пример #15
0
        async void bookmark_click(object sender, RoutedEventArgs e, string card, string dir, Button bookmark)
        {
            MaterialDesignThemes.Wpf.Card actual = (MaterialDesignThemes.Wpf.Card)modpacksListContainer.FindName(card);

            var iconpackbookmark = new MaterialDesignThemes.Wpf.PackIcon();

            System.Collections.Specialized.StringCollection x = (System.Collections.Specialized.StringCollection)Properties.Settings.Default["bookmarks"];
            foreach (var i in x)
            {
                if (i == dir)
                {
                    x.Remove(dir);
                    iconpackbookmark      = new MaterialDesignThemes.Wpf.PackIcon();
                    iconpackbookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.Bookmark;
                    bookmark.Content      = iconpackbookmark;
                    bookmark.ToolTip      = "This modpack is not bookmarked";
                    Properties.Settings.Default.Save();
                    return;
                }
            }
            try
            {
                var json = System.IO.File.ReadAllText(dir + "\\" + new DirectoryInfo(dir).Name + ".json");
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show("This modpack cannot be bookmarked. We suggest you to delete it");
                return;
            }
            x.Add(dir);
            iconpackbookmark      = new MaterialDesignThemes.Wpf.PackIcon();
            iconpackbookmark.Kind = MaterialDesignThemes.Wpf.PackIconKind.BookmarkCheck;
            bookmark.Content      = iconpackbookmark;
            bookmark.ToolTip      = "This modpack is bookmarked";
            Properties.Settings.Default.Save();
        }
 /// <summary>
 /// удалить по имени
 /// </summary>
 /// <param name="name"></param>
 public void Remove(string name)
 {
     BaseRemove(name);
     keys.Remove(name);
 }