示例#1
0
        //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);
            }
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        public void setActiveButton(ButtonEntity incomingButton, bool deletedButton)
        {
            activeButton = incomingButton;
            NewActiveHandlerArgs testArgs = new NewActiveHandlerArgs(deletedButton); //Take out here if not work

            OnChanged(testArgs);
        }
示例#4
0
        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);
            }
        }
示例#5
0
 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();
 }
示例#6
0
        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();
        }
示例#7
0
 //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;
     }
 }
示例#8
0
        //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;
            }
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
 public void AddNewButton(ButtonEntity newButton)
 {
     masterArray.Add(newButton);
 }
示例#12
0
 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);
     }
 }
示例#13
0
        //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);
            }
        }
示例#14
0
 public void setActiveButton(ButtonEntity incomingButton, bool deletedButton)
 {
     activeButton = incomingButton;
     NewActiveHandlerArgs testArgs = new NewActiveHandlerArgs(deletedButton); //Take out here if not work
     OnChanged(testArgs);
 }
示例#15
0
        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);
                }
            }
        }
示例#16
0
 public void AddNewButton(ButtonEntity newButton)
 {
     masterArray.Add(newButton);
 }