コード例 #1
0
ファイル: InterfaceModel.cs プロジェクト: nunocgtt/heliopolis
 public InterfaceModel(Point screenSize, GameWorld world, Game xnaGame)
 {
     _world                          = world;
     ZoomedIn                        = false;
     ScreenSize                      = screenSize;
     CameraPos                       = new Point(0, 0);
     CurrentSelectionState           = SelectionState.None;
     CurrentAction                   = null;
     UserInterface                   = new InterfaceFactory().CreateUserInterface(xnaGame, UIFileToLoad, screenSize.X, screenSize.Y, this);
     UserInterface.GameValueProvider = this;
     _interfaceState                 = new Stack <InterfaceState>();
     _interfaceState.Push(InterfaceState.None);
 }
コード例 #2
0
        private CodeFragmentManager CreateFromContent(string scriptContent)
        {
            MemoryStream inputStream = new MemoryStream(
                Encoding.Default.GetBytes(scriptContent));

            IParsedScript parsedScript = InterfaceFactory.CreateParsedScript();

            if (parsedScript.ParseStream(inputStream))
            {
                return(new CodeFragmentManager(parsedScript));
            }

            return(null);
        }
コード例 #3
0
        internal ScriptObject(string fileContent)
        {
            this.ScriptModifiedExternal = false;
            this.parsedScript           = InterfaceFactory.CreateParsedScript();

            if (string.IsNullOrEmpty(fileContent) == false)
            {
                MemoryStream inputStream = new MemoryStream(
                    Encoding.Default.GetBytes(fileContent));

                this.parsedScript.ParseStream(inputStream);
            }

            scriptState = new ScriptState(new TextBuffer(fileContent));
        }
コード例 #4
0
        private void Run()
        {
            #region Initialize sensor
            // Get an instance of the sensor class using the assembly and class names.
            //SensorInterface = InterfaceFactory.CreateSensorInstance("Scallop.Sensor.FileSource.dll");
            SensorInterface = InterfaceFactory.CreateSensorInstance("Scallop.Sensor.Axis.dll");

            // Define the handler functions
            SensorInterface.Data          += new EventHandler <ScallopSensorDataEventArgs>(SensorInterface_Data);
            SensorInterface.StatusChanged += new EventHandler <ScallopSensorStatusChangedEventArgs>(SensorInterface_StatusChanged);
            SensorInterface.Info          += new EventHandler <ScallopInfoEventArgs>(SensorInterface_Info);

            // Configure the sensor interface with parameters from an XML file.
            SensorInterface.Register(XDocument.Load(SensorConfigFile), null);
            #endregion

            #region Initialize network
            // Get instance of network class.
            NetworkInterface = InterfaceFactory.CreateNetworkInstance("Scallop.Network.PeerChannel.dll");

            // Define handler functions.
            NetworkInterface.Data          += new EventHandler <ScallopNetworkDataEventArgs>(NetworkInterface_Data);
            NetworkInterface.StatusChanged += new EventHandler <ScallopNetworkStatusChangedEventArgs>(NetworkInterface_StatusChanged);
            NetworkInterface.Info          += new EventHandler <ScallopInfoEventArgs>(NetworkInterface_Info);
            #endregion

            // Start sensor.
            SensorInterface.Start();
            // Join network.
            System.Xml.XmlDocument NetworkConfig = new System.Xml.XmlDocument();
            NetworkConfig.Load(NetworkConfigFile);
            NetworkInterface.Join(NetworkConfig, null);

            do
            {
                // infinite loop
                System.Threading.Thread.Sleep(1000);
            } while (true);
        }
コード例 #5
0
ファイル: Run.cs プロジェクト: matiasLAVA/Interface_Calico
        static void Main(string[] args)
        {
            // Validamos la existencia de argumentos
            String message = null;

            if (!Utils.ValidateArgs(args, out message))
            {
                Console.Error.WriteLine(message);
                return;
            }

            // Se loguea si un argumento es "/l"
            Utils.InstanceConsole(args);
            Console.WriteLine("Logueo activado");

            // Instanciamos la interface que llego como primer argumento
            InterfaceGeneric interfaz = (args != null && args.Length > 0) ? InterfaceFactory.GetInterfaz(args[0]) : null;

            if (interfaz == null)
            {
                Console.Error.WriteLine("Interface inexistente");
                return;
            }

            // Validacion de fecha
            DateTime?dateTime = null;

            if (interfaz.ValidateDate())
            {
                dateTime = Utils.GetDate(args);
                if (dateTime == null)
                {
                    Console.WriteLine("Fecha no indicada o posee un formato erroneo,se tomará de la tabla BIANCHI_PROCESS");
                }
            }
            // Procesamos
            interfaz.Process(dateTime);
        }
コード例 #6
0
        internal IScriptObject OpenScript(string scriptPath)
        {
            solutionModified       = true; // Changes should be persisted.
            showSaveSolutionDialog = true;

            if (File.Exists(scriptPath) == false)
            {
                return(null); // The file does not exist.
            }
            // If the entire script is so messed up that it cannot even be
            // parsed in a meaningful way, then "ParseScript" call will fail.
            // When that happens, we don't return "null" from here, the file
            // open should continue (and errors be shown as red colored text).
            IParsedScript parsedScript = InterfaceFactory.CreateParsedScript();

            parsedScript.ParseScript(scriptPath);

            // Add the new script to loaded scripts.
            IScriptObject hostScript = new ScriptObject(parsedScript);

            loadedScripts.Add(hostScript);

            // Notify event subscribers that the script count has changed.
            if (null != ScriptCountChanged)
            {
                ScriptCountChangedEventArgs eventArgs = new ScriptCountChangedEventArgs();
                eventArgs.ScriptsAdded.Add(hostScript);
                ScriptCountChanged(this, eventArgs);
            }

            // Subscribe to the new text buffer event notification.
            ITextBuffer textBuffer = hostScript.GetTextBuffer();

            textBuffer.LinesUpdated += linesUpdatedHandler;
            return(hostScript);
        }