Esempio n. 1
0
        private void AddEntry_Click(object sender, EventArgs e)
        {
            //add textbox contents to list
            if (Key.Text.Length > 0 && Value.Text.Length > 0)
            {
                string key   = ProcessOutputKey(Key.Text);
                string value = ProcessOutputValue(Value.Text);

                if (Mapping.ContainsKey(key))
                {
                    MessageBox.Show("This map already contains the key " + key);
                }
                else
                {
                    EntryList.Items.Add((object)key + " : " + (object)value);
                    Mapping.Add(key, value);
                    Key.Text   = "";
                    Value.Text = "";

                    RoomConnectionArgs args = new RoomConnectionArgs(null, value, ProcessInputKey(key), ConnectionType.Connect);
                    this.PostUpdate(this, args);
                }
            }
            else
            {
                Utility.MessageBeep(Utility.MB_OK);
            }
        }
Esempio n. 2
0
        private void RemoveEntry_Click(object sender, EventArgs e)
        {
            if (EntryList.SelectedItem != null)
            {
                string entry = (string)EntryList.SelectedItem;
                Dictionary <string, string> temp = ParserTools.StringIntoMap("([" + entry + "])", this.FunctionName + "Control.RemoveEntry()");
                Dictionary <string, string> .KeyCollection.Enumerator iter = temp.Keys.GetEnumerator();
                iter.MoveNext();
                RoomConnectionArgs args = new RoomConnectionArgs(null, temp[iter.Current], ProcessInputKey(iter.Current), ConnectionType.Disconnect);
                Mapping.Remove(iter.Current);

                EntryList.Items.Remove(EntryList.SelectedItem);

                this.PostUpdate(this, args);
            }
            else
            {
                Utility.MessageBeep(Utility.MB_OK);
            }
        }
        public void ConnectRoom(MouseMoveArgs mma)
        {
            if (DeactivateDragLine != null)
            {
                DeactivateDragLine(this, null);
            }

            //if we are over another image, attach the connection to that
            if (HilightMouseover(mma))
            {
                //connect
                State = MouseStates.Hover;

                refHoveredNode.SetTarget(refHoveredImage);
                RoomConnectionArgs args = new RoomConnectionArgs(refHoveredNode.Source.RoomName,
                                                                 refHoveredImage.RoomName,
                                                                 refHoveredNode.Direction,
                                                                 ConnectionType.Connect);

                if (SetConnection != null)
                {
                    SetConnection(this, args);
                }
            }
            else
            {
                //disconnect
                State = MouseStates.Normal;
                RoomConnectionArgs args = new RoomConnectionArgs(refHoveredNode.Source.RoomName,
                                                                 refHoveredNode.Target.RoomName,
                                                                 refHoveredNode.Direction,
                                                                 ConnectionType.Disconnect);
                refHoveredNode.SetTarget(null);
                if (RemoveConnection != null)
                {
                    RemoveConnection(this, args);
                }
            }
        }