Example #1
0
        /// <summary>
        /// Gets rid of any active sub-dialog(s).
        /// </summary>
        void KillDialogs()
        {
            if (m_DialFrom != null)
            {
                m_DialFrom.Dispose();
                m_DialFrom = null;
            }

            if (m_DialTo != null)
            {
                m_DialTo.Dispose();
                m_DialTo = null;
            }

            if (m_DialPath != null)
            {
                m_DialPath.Dispose();
                m_DialPath = null;
            }

            if (m_DialUp != null)
            {
                m_DialUp.Dispose();
                m_DialUp = null;
            }
        }
        internal void PrepareXML(Initiator initiator, XmlDocument xmlDocument, List <string> xmlNodesNamesList)
        {
            this.xmlPreparerCallback = initiator;
            CheckIfLegal(xmlDocument);

            if (!PathForm.GetRunOver() && LayoutElementExists(xmlDocument))
            {
                xmlPreparerCallback.OnXmlPrepareEnd(xmlDocument);
                return;
            }

            if (PathForm.GetRunOver() && LayoutElementExists(xmlDocument))
            {
                //need to go to remote and delete the layout from there!
                XmlNode xmlnode = xmlDocument.GetElementsByTagName(TAG_REMOTE)[0];
                xmlnode.RemoveChild(xmlDocument.GetElementsByTagName(TAG_LAYOUT)[0]);
                xmlDocument.Save(PathForm.GetXmlPath());
            }

            XmlElement layoutElement = GetLayoutElement(xmlDocument);

            SetRectElementsTags(xmlDocument, layoutElement, xmlNodesNamesList);
            xmlDocument.Save(PathForm.GetXmlPath());
            xmlPreparerCallback.OnXmlPrepareEnd(xmlDocument);
        }
        public void WaitForUserAction(IUserActionCallback userAcitonCallback)
        {
            KeyboardWatcher.Start();
            MouseWatcher.Start();
            validated = false;
            undoed    = false;
            MouseWatcher.OnMouseInput += (s, e) =>
            {
                if (e.Message.ToString().Equals(PathForm.GetValidationBtnName()) && !validated)
                {
                    Validated(userAcitonCallback);
                }
            };

            KeyboardWatcher.OnKeyInput += (s, e) =>
            {
                Console.WriteLine("btn name: " + e.KeyData.Keyname);
                if (e.KeyData.Keyname.Equals(UNDO) && !undoed)
                {
                    Undo(userAcitonCallback);
                }


                if (e.KeyData.Keyname.Equals(PathForm.GetValidationBtnName()) && !validated)
                {
                    Validated(userAcitonCallback);
                }
            };
        }
Example #4
0
 /// <summary>
 /// Ensures all class data has initial values (for use by constructors)
 /// </summary>
 void Zero()
 {
     m_DialFrom = null;
     m_DialTo   = null;
     m_DialPath = null;
     m_DialUp   = null;
     m_From     = null;
     m_To       = null;
 }
Example #5
0
        /// <summary>
        /// Starts the main connection path sub-dialog.
        /// </summary>
        void StartPath()
        {
            Debug.Assert(m_DialFrom == null);
            Debug.Assert(m_DialTo == null);

            if (m_From == null || m_To == null)
            {
                throw new Exception("Terminal points are unavailable.");
            }

            m_DialPath = new PathForm(this, m_From, m_To);
            m_DialPath.Show();
        }
Example #6
0
        public void OnBtnMarked(RectNodeObj rectObj)
        {
            if (currentRectNode == null)
            {
                mouseCoordinator.ShowMouseNotification("YEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
                Application.Exit();
                return;
            }
            currentRectNode.Attributes[XMLPreparer.ATT_X].Value      = rectObj.getX();
            currentRectNode.Attributes[XMLPreparer.ATT_Y].Value      = rectObj.getY();
            currentRectNode.Attributes[XMLPreparer.ATT_WIDTH].Value  = rectObj.getWidth();
            currentRectNode.Attributes[XMLPreparer.ATT_HEIGHT].Value = rectObj.getHeight();

            xmlDocument.Save(PathForm.GetXmlPath());
            CheckNextVal();
        }
Example #7
0
        private void Remote_Pic_MouseUp(object sender, MouseEventArgs e)
        {
            xEnd = e.Location.X;
            yEnd = e.Location.Y;

            width  = xEnd - xStart;
            height = yEnd - yStart;
            Console.WriteLine("x: " + xStart + ", y: " + yStart + ", width: " + width + ", height: " + height);

            if (PathForm.GetValidationBtnName() != null)
            {
                HookEventsManager.WaitForUserAction(this);
            }

            else
            {
                OnBtnValidated();
            }
        }
        internal List <String> RemoveWrongTvKeys(XmlDocument xmlDocument)
        {
            XmlNode papaKeyNode     = xmlDocument.GetElementsByTagName(XMLReader.ATT_KEYS)[0];
            int     papaChildsCount = papaKeyNode.ChildNodes.Count;

            //we will make two lists: one for the names and one for the correct node values (all of the key nodes without the tv ones)
            List <XmlNode> keysNodesList = new List <XmlNode>();
            List <string>  keyNames      = new List <string>();

            foreach (XmlNode keyNode in papaKeyNode.ChildNodes)
            {
                //if it is a tv node, ignore it and dont add it to the list
                string keyName = keyNode.Attributes[XMLPreparer.ATT_NAME].Value;
                if (keyName.Equals(KEY_TV) || keyName.Equals(KEY_AV) || keyName.Equals(KEY_VOL_UP) || keyName.Equals(KEY_VOL_DOWN) || keyName.Equals(KEY_MUTE))
                {
                    continue;
                }

                //else add it, and add it's name
                else
                {
                    keysNodesList.Add(keyNode.Clone());
                    keyNames.Add(keyName);
                }
            }

            //remove the keys from the keys papa and add the relevant one, one by one, to the empy papa
            papaKeyNode.RemoveAll();
            foreach (XmlNode keyNode in keysNodesList)
            {
                papaKeyNode.AppendChild(keyNode);
            }

            xmlDocument.Save(PathForm.GetXmlPath());
            return(keyNames);
        }
 public void OnWritingEnd(XmlDocument xmlDocument)
 {
     xmlDocument.Save(PathForm.GetXmlPath());
     callBack.onFileMade();
 }