//Method to remove a button from master lib (Called from drawer app bar) private void DeleteButton_Click(object sender, EventArgs e) { ButtonEntity tempDelete = new ButtonEntity("Standard"); tempDelete = (ButtonEntity)(sender as MenuItem).Tag; int selectionIndex = 0; selectionIndex = myStorage.FindIndexByName(tempDelete.buttonText); //Below doesn't work right, now - need to get the index of the button if (selectionIndex > 2) { tempDelete = currentApp.globalLib.masterArray[selectionIndex]; } if (selectionIndex > 2) { currentApp.globalLib.masterArray.RemoveAt(selectionIndex); } if (tempDelete.isDefault == false) { myStorage.DeleteNameArray(); myStorage.SaveNameArray(); myStorage.DeleteButtonStorage(tempDelete.buttonText); } ButtonEntity tempButton = new ButtonEntity("Standard"); if (selectionIndex > 2) { tempButton = currentApp.globalLib.masterArray[currentApp.globalLib.masterArray.Count - 1]; ActiveVM.setActiveButton(tempButton, true); } }
public void LoadAllButtons() { this.RetrieveNameArray(); ButtonEntity[] tempButtonLib = new ButtonEntity[currentApp.buttonNames.Length]; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; if (currentApp.buttonNames[0] != "emptyAdam") { int i = 0; foreach (string loadName in currentApp.buttonNames) { ButtonEntity tempButton = new ButtonEntity("Standard"); string header = loadName + "_"; tempButton.buttonText = IsolatedStorageSettings.ApplicationSettings[header + "buttonText"] as string; tempButton.buttonAudioUri = IsolatedStorageSettings.ApplicationSettings[header + "buttonAudioUri"] as string; tempButton.isDefault = Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[header + "isDefault"] as string); tempButton.colorString = IsolatedStorageSettings.ApplicationSettings[header + "colorString"] as string; tempButtonLib[i] = tempButton; i++; } foreach (ButtonEntity toAdd in tempButtonLib) { currentApp.globalLib.masterArray.Add(toAdd); } } }
public void setActiveButton(ButtonEntity incomingButton, bool deletedButton) { activeButton = incomingButton; NewActiveHandlerArgs testArgs = new NewActiveHandlerArgs(deletedButton); //Take out here if not work OnChanged(testArgs); }
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { ButtonEntity tempButton = new ButtonEntity("Standard"); if (listBox1.SelectedIndex != -1) { tempButton = currentApp.globalLib.masterArray[listBox1.SelectedIndex]; ActiveVM.setActiveButton(tempButton, false); } }
public void AddButtonStorage(ButtonEntity newButton) { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; string header = newButton.buttonText + "_"; settings.Add(header+"buttonText", newButton.buttonText); settings.Add(header + "buttonAudioUri", newButton.buttonAudioUri); settings.Add(header + "isDefault", newButton.isDefault); settings.Add(header + "colorString", newButton.colorString); settings.Add(header + "buttonColor", newButton.buttonColor.ToString()); settings.Save(); }
public void AddButtonStorage(ButtonEntity newButton) { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; string header = newButton.buttonText + "_"; settings.Add(header + "buttonText", newButton.buttonText); settings.Add(header + "buttonAudioUri", newButton.buttonAudioUri); settings.Add(header + "isDefault", newButton.isDefault); settings.Add(header + "colorString", newButton.colorString); settings.Add(header + "buttonColor", newButton.buttonColor.ToString()); settings.Save(); }
//Method/Event handler that responds to a new button being made active - Sets up all the necessary things void ActiveVM_NewActiveButton(object sender, MassiveAttack.PressVM.NewActiveHandlerArgs e) { SolidColorBrush tempColor = new SolidColorBrush(); curentButton = ActiveVM.activeButton; bigButton1.buttonText.Text = this.curentButton.buttonText; tempColor = (SolidColorBrush)myConvert.Convert(this.curentButton.colorString, null, null, null); bigButton1.buttonFace.Fill = tempColor; resetSound(); if (e.wasDeleted == false) { Pivot.SelectedItem = Button; } }
//Method/Event handler that responds to a new button being made active - Sets up all the necessary things void ActiveVM_NewActiveButton(object sender, MassiveAttack.PressVM.NewActiveHandlerArgs e) { SolidColorBrush tempColor = new SolidColorBrush(); curentButton = ActiveVM.activeButton; bigButton1.buttonText.Text = this.curentButton.buttonText; tempColor = (SolidColorBrush)myConvert.Convert(this.curentButton.colorString, null, null, null); bigButton1.buttonFace.Fill = tempColor; resetSound(); if (e.wasDeleted == false) { Pivot.SelectedItem = Button; } }
public MainPage() { InitializeComponent(); myStorage.LoadAllButtons(); //Ping PressVM to get the active button for main page curentButton = ActiveVM.activeButton; resetSound(); //Set up data binding for drawer listBox1.ItemsSource = currentApp.globalLib.masterArray; listBox1.DataContext = currentApp.globalLib.masterArray; bigButton1.DataContext = this.curentButton; this.bigButton1.buttonFace.MouseLeftButtonDown += new MouseButtonEventHandler(mouse_playButton); this.bigButton1.buttonText.MouseLeftButtonDown += new MouseButtonEventHandler(mouse_playButton); ActiveVM.Active += new PressVM.NewActiveHandler(ActiveVM_NewActiveButton); }
public MainPage() { InitializeComponent(); myStorage.LoadAllButtons(); //Ping PressVM to get the active button for main page curentButton = ActiveVM.activeButton; resetSound(); //Set up data binding for drawer listBox1.ItemsSource = currentApp.globalLib.masterArray; listBox1.DataContext = currentApp.globalLib.masterArray; bigButton1.DataContext = this.curentButton; this.bigButton1.buttonFace.MouseLeftButtonDown += new MouseButtonEventHandler(mouse_playButton); this.bigButton1.buttonText.MouseLeftButtonDown += new MouseButtonEventHandler(mouse_playButton); ActiveVM.Active += new PressVM.NewActiveHandler(ActiveVM_NewActiveButton); }
public void AddNewButton(ButtonEntity newButton) { masterArray.Add(newButton); }
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { ButtonEntity tempButton = new ButtonEntity("Standard"); if (listBox1.SelectedIndex != -1) { tempButton = currentApp.globalLib.masterArray[listBox1.SelectedIndex]; ActiveVM.setActiveButton(tempButton, false); } }
//Method to remove a button from master lib (Called from drawer app bar) private void DeleteButton_Click(object sender, EventArgs e) { ButtonEntity tempDelete = new ButtonEntity("Standard"); tempDelete = (ButtonEntity)(sender as MenuItem).Tag; int selectionIndex = 0; selectionIndex = myStorage.FindIndexByName(tempDelete.buttonText); //Below doesn't work right, now - need to get the index of the button if (selectionIndex > 2) { tempDelete = currentApp.globalLib.masterArray[selectionIndex]; } if (selectionIndex > 2) { currentApp.globalLib.masterArray.RemoveAt(selectionIndex); } if (tempDelete.isDefault == false) { myStorage.DeleteNameArray(); myStorage.SaveNameArray(); myStorage.DeleteButtonStorage(tempDelete.buttonText); } ButtonEntity tempButton = new ButtonEntity("Standard"); if (selectionIndex > 2) { tempButton = currentApp.globalLib.masterArray[currentApp.globalLib.masterArray.Count - 1]; ActiveVM.setActiveButton(tempButton, true); } }
public void setActiveButton(ButtonEntity incomingButton, bool deletedButton) { activeButton = incomingButton; NewActiveHandlerArgs testArgs = new NewActiveHandlerArgs(deletedButton); //Take out here if not work OnChanged(testArgs); }
public void LoadAllButtons() { this.RetrieveNameArray(); ButtonEntity[] tempButtonLib = new ButtonEntity[currentApp.buttonNames.Length]; IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; if (currentApp.buttonNames[0] != "emptyAdam") { int i = 0; foreach (string loadName in currentApp.buttonNames) { ButtonEntity tempButton = new ButtonEntity("Standard"); string header = loadName + "_"; tempButton.buttonText = IsolatedStorageSettings.ApplicationSettings[header + "buttonText"] as string; tempButton.buttonAudioUri = IsolatedStorageSettings.ApplicationSettings[header + "buttonAudioUri"] as string; tempButton.isDefault = Convert.ToBoolean(IsolatedStorageSettings.ApplicationSettings[header + "isDefault"] as string); tempButton.colorString = IsolatedStorageSettings.ApplicationSettings[header + "colorString"] as string; tempButtonLib[i] = tempButton; i++; } foreach (ButtonEntity toAdd in tempButtonLib) { currentApp.globalLib.masterArray.Add(toAdd); } } }
public void AddNewButton(ButtonEntity newButton) { masterArray.Add(newButton); }