Provides data for an output event.
Inheritance: System.EventArgs
Esempio n. 1
0
        private void vm_OutputReady(object sender, OutputReadyEventArgs e)
        {
            ViewModelLocator.Invoke(new Action(() => {
                if (e.Package.Keys.Count > 0)
                {
                    if (command.ToLower() == "save" || command.ToLower() == "restore")
                    {
                        return;
                    }

                    ChannelData = (Dictionary<string, string>)e.Package;
                }
            }));

        }
Esempio n. 2
0
 /// <summary>
 /// Sends the queued output to the <see cref="OutputReady"/> event handler.
 /// </summary>
 private void DeliverOutput()
 {
     if (OutputReady != null)
     {
         OutputReadyEventArgs args = new OutputReadyEventArgs();
         args.Package = outputBuffer.Flush();
         OutputReady(this, args);
     }
 }
Esempio n. 3
0
        //private void SetChannelData(string channel, Dictionary<string, string> package, XmlWriter writer)
        //{
        //    string text = "";
        //    string channelName = channel;
        //    if (package.TryGetValue(channel, out text))
        //    {
        //        WriteElementCDATA(writer, channelName, text.Trim());
        //    }
        //    else
        //    {
        //        WriteElementCDATA(writer, channelName, "");
        //    }
        //}
        //private void SetChannelDataJSON(string channel, Dictionary<string, string> package, JsonTextWriter writer)
        //{
        //    string text = "";
        //    string channelName = channel;
        //    if (package.TryGetValue(channel, out text))
        //    {
        //        writer.WritePropertyName(channel);
        //        writer.WriteValue(text);
        //    }
        //    else
        //    {
        //        writer.WritePropertyName(channel);
        //        writer.WriteValue("");
        //    }
        //}
        //private void WriteElementCDATA(XmlWriter xWriter, string elementName, string text)
        //{
        //    xWriter.WriteStartElement(elementName);
        //    xWriter.WriteCData(text);
        //    xWriter.WriteEndElement();
        //}
        private void vm_OutputReady(object sender, OutputReadyEventArgs e)
        {
            // ----------- DECIDE TO STORE OUTPUT --------------

            if ((wrapperState == VMWrapperState.LoadGame && requestType == VMRequestType.StartGame) || wrapperState == VMWrapperState.RunCommand)
            {
                HandleOutput((Dictionary<string, string>)e.Package);
            }

            // ----------- DETERMINE STATE -------------

            if (wrapperState == VMWrapperState.RequestSave)
            {
                outSaveFile = saveStream.ToArray();
                vm.Stop();
            }

            if (wrapperState == VMWrapperState.RunCommand || (wrapperState == VMWrapperState.LoadGame && requestType == VMRequestType.StartGame))
                wrapperState = VMWrapperState.RequestSave;

            if (wrapperState == VMWrapperState.RequestRestore && requestType == VMRequestType.ExecuteCommand)
                wrapperState = VMWrapperState.RunCommand;

            if (wrapperState == VMWrapperState.LoadGame && requestType == VMRequestType.ExecuteCommand)
                wrapperState = VMWrapperState.RequestRestore;
        }