Esempio n. 1
0
        private void IntegratedCircuitControl_DoubleClick(object sender, System.EventArgs e)
        {
            string fileName;

            if (!DialogUtils.OpenFile(null, out fileName))
            {
                return;
            }

            var data = ReadData(fileName);

            if (data == null)
            {
                return;
            }

            var elementData = new IntegratedCircuitData();

            elementData.Id              = ElementId;
            elementData.Type            = ElementType.IntegratedCircuit;
            elementData.Elements        = data.Elements;
            elementData.ExternalInputs  = ConvertFreeInputs(data.Elements);
            elementData.ExternalOutputs = ConvertFreeOutputs(data.Elements);
            elementData.Wires           = data.Wires;
            elementData.Name            = Path.GetFileNameWithoutExtension(fileName);

            SetData(elementData);
        }
        public override void Execute()
        {
            string fileName;

            if (!DialogUtils.OpenFile(mainForm, out fileName))
            {
                return;
            }

            var data = ReadData(fileName);

            if (data == null)
            {
                return;
            }

            var designer = new FormDesign();

            designer.MdiParent = mainForm;
            designer.SetCircuitData(data);

            mainForm.AddOpenedDesigner(designer);
            designer.Closed += (sender, args) => mainForm.RemoveOpenedDesigner(designer);

            designer.IsModified    = false;
            designer.FilePath      = fileName;
            designer.IsFileNameSet = true;

            designer.Show();
        }
        public static void LoadZoneFileDbg()
        {
            string path = DialogUtils.OpenFile("Load Zone File", "", "zone");

            if (path != null)
            {
                ForgelightGame game = new ForgelightGame("hehe", "", "");
                if (!game.LoadZoneFromFile(path))
                {
                    DialogUtils.DisplayDialog("Zone Import Failed", "An error occurred while loading the zone file. Please check the console window for more info.");
                }
            }
        }
        public static void LoadZoneFile()
        {
            if (ForgelightExtension.Instance.ForgelightGameFactory.ActiveForgelightGame == null)
            {
                DialogUtils.DisplayDialog("No Active Game", "There is currently no active forgelight game. Please load the correct forgelight game and try again.");
                return;
            }

            string path = DialogUtils.OpenFile("Load Zone File", "", "zone");

            if (path != null)
            {
                if (!ForgelightExtension.Instance.ForgelightGameFactory.ActiveForgelightGame.LoadZoneFromFile(path))
                {
                    DialogUtils.DisplayDialog("Zone Import Failed", "An error occurred while loading the zone file. Please check the console window for more info.");
                }
            }
        }