예제 #1
0
        private void NameButton_Click(object sender, RoutedEventArgs e)
        {
            sceneName  = "";
            sceneColor = 0;
            SceneNameWindow nameWindow = new SceneNameWindow(this.SceneCombo.SelectedItem.ToString());

            nameWindow.Owner = this;
            nameWindow.ShowDialog();

            if (sceneName != "")
            {
                ComboItem tempItem = (ComboItem)SceneCombo.SelectedItem;
                JsonParser.Modify(Storage.sceneData, new string[] { tempItem.idStore, "name" }, sceneName);
                JsonParser.Modify(Storage.sceneData, new string[] { tempItem.idStore, "tilecolor" }, sceneColor);

                int tempIndex = this.SceneCombo.SelectedIndex;
                this.SceneCombo.Items[tempIndex] = new ComboItem(sceneName, tempItem.idStore);
                this.SceneCombo.SelectedIndex    = tempIndex;
            }
        }
예제 #2
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            sceneName  = "";
            sceneColor = 0;
            SceneNameWindow nameWindow = new SceneNameWindow();

            nameWindow.Owner = this;
            nameWindow.ShowDialog();

            if (sceneName != "")
            {
                Random randomID = new Random();
                string sceneID  = String.Format("scene_{0}", randomID.Next(10000000, 99999999).ToString());
                if (JsonParser.Read(Storage.sceneData, new string[] { sceneID, sceneName }) == null)
                {
                    dynamic newScene = SceneCreation(sceneName, sceneColor);

                    JsonParser.Create(Storage.sceneData, new string[] { sceneID }, newScene);

                    //Add new scene to MainWindow
                    for (int i = 1; i <= 8; i++)
                    {
                        string setting = String.Format("customSelected{0}", i.ToString());
                        if ((string)Properties.Settings.Default[setting] == "")
                        {
                            Properties.Settings.Default[setting] = sceneID;
                            break;
                        }
                    }

                    //Append list of scenes
                    this.SceneCombo.Items.Add(new ComboItem(JsonParser.Read(Storage.sceneData, new string[] { sceneID, "name" }), sceneID));
                    this.SceneCombo.SelectedIndex = this.SceneCombo.Items.Count - 1;
                }
                else
                {
                    MessageBox.Show("ID already in use. (This error should not occur. Try saving the scene again.)");
                }
            }
        }
예제 #3
0
		private void NameButton_Click(object sender, RoutedEventArgs e)
		{
			sceneName = "";
			sceneColor = 0;
			SceneNameWindow nameWindow = new SceneNameWindow(this.SceneCombo.SelectedItem.ToString());
			nameWindow.Owner = this;
			nameWindow.ShowDialog();

			if (sceneName != "") {
				ComboItem tempItem = (ComboItem)SceneCombo.SelectedItem;
				JsonParser.Modify(Storage.sceneData, new string[] { tempItem.idStore, "name" }, sceneName);
				JsonParser.Modify(Storage.sceneData, new string[] { tempItem.idStore, "tilecolor" }, sceneColor);

				int tempIndex = this.SceneCombo.SelectedIndex;
				this.SceneCombo.Items[tempIndex] = new ComboItem(sceneName, tempItem.idStore);
				this.SceneCombo.SelectedIndex = tempIndex;
			}
		}
예제 #4
0
		private void SaveButton_Click(object sender, RoutedEventArgs e)
		{
			sceneName = "";
			sceneColor = 0;
			SceneNameWindow nameWindow = new SceneNameWindow();
			nameWindow.Owner = this;
			nameWindow.ShowDialog();

			if (sceneName != "") {
				Random randomID = new Random();
				string sceneID = String.Format("scene_{0}", randomID.Next(10000000, 99999999).ToString());
				if (JsonParser.Read(Storage.sceneData, new string[] { sceneID, sceneName }) == null) {
					dynamic newScene = SceneCreation(sceneName, sceneColor);

					JsonParser.Create(Storage.sceneData, new string[] { sceneID }, newScene);

					//Add new scene to MainWindow
					for (int i = 1; i <= 8; i++) {
						string setting = String.Format("customSelected{0}", i.ToString());
						if ((string)Properties.Settings.Default[setting] == "") {
							Properties.Settings.Default[setting] = sceneID;
							break;
						}
					}

					//Append list of scenes
					this.SceneCombo.Items.Add(new ComboItem(JsonParser.Read(Storage.sceneData, new string[] { sceneID, "name" }), sceneID));
					this.SceneCombo.SelectedIndex = this.SceneCombo.Items.Count - 1;

				} else {
					MessageBox.Show("ID already in use. (This error should not occur. Try saving the scene again.)");
				}
			}
		}