Beispiel #1
0
        public void ShouldAssignInlineTemplate()
        {
            DataTemplate template = new DataTemplate();
            Editor       editor   = new TypeEditor(typeof(string), template);

            Assert.AreEqual(template, editor.InlineTemplate);
        }
 public StationItem(TypeEditor interfaceType)
 {
     icoAngle    = 0f;
     stationArea = new List <StationAreaItem>();
     alignEdition(interfaceType, null);
     areaCompleted = false;
 }
        static public ORRouteConfig LoadConfig(string fileName, string path, TypeEditor interfaceType)
        {
            string        completeFileName = Path.Combine(path, fileName);
            ORRouteConfig loaded           = DeserializeJSON(completeFileName, interfaceType);

            return(loaded);
        }
Beispiel #4
0
        public MSTSDataConfig(string mstsPath, string Route, TypeEditor interfaceType) : base(mstsPath, Route)
        {
            string routePath = Path.Combine(Route, TRK.Tr_RouteFile.FileName);

            TileBase = new MSTSBase(TDB);
            TileBase.reduce(TDB);
        }
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setMovable();
         setRotable();
     }
 }
Beispiel #6
0
        public void ShouldAssignInlineAndExtendedTemplates()
        {
            DataTemplate template1 = new DataTemplate();
            DataTemplate template2 = new DataTemplate();
            Editor       editor    = new TypeEditor(typeof(string), template1, template2);

            Assert.AreEqual(template1, editor.InlineTemplate);
            Assert.AreEqual(template2, editor.ExtendedTemplate);
        }
Beispiel #7
0
 public override void alignEdition(TypeEditor interfaceType, GlobalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setEditable();
         asMetadata = true;
     }
     parentStation = (StationItem)ownParent;
 }
Beispiel #8
0
        public void ShouldFindTypeEditorByTypeName()
        {
            EditorCollection editors = new EditorCollection();
            TypeEditor       editor  = new TypeEditor(typeof(int), new DataTemplate());

            editors.Add(editor);

            Assert.AreEqual <TypeEditor>(editor, editors.FindTypeEditor(typeof(int)));
        }
Beispiel #9
0
 public void UnsetFocus(TypeEditor viewerMode)
 {
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         AEConfigPanel.SuspendLayout();
         AEConfigPanel.Visible = false;
     }
     routeData.SuspendLayout();
     routeData.Visible = false;
 }
        public ActWaitItem(TypeEditor interfaceType)
            : base(interfaceType)
        {
            Stream   st;
            Assembly a = Assembly.GetExecutingAssembly();

            typeItem = (int)TypeEvent.ACTIVITY_WAIT;
            st       = a.GetManifestResourceStream("LibAE.Icon.Wait.ico");
            WaitIcon = new System.Drawing.Icon(st);
        }
Beispiel #11
0
 public void Close(TypeEditor viewerMode)
 {
     aeRouteConfig.CloseRoute();
     routeData.Visible = false;
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         aeActivity.ClosegActivity();
         AEConfigPanel.Visible = false;
     }
 }
Beispiel #12
0
        public ITextEditor GetEditor(int type)
        {
            TypeEditor typeEditor = (TypeEditor)type;

            if (editors.ContainsKey(typeEditor))
            {
                return(editors[typeEditor]);
            }
            return(null);
        }
Beispiel #13
0
 public void SetFocus(TypeEditor viewerMode)
 {
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         AEConfigPanel.Visible = true;
         AEConfigPanel.ResumeLayout(false);
     }
     routeData.Visible = true;
     routeData.ResumeLayout(false);
 }
 public override void alignEdition(TypeEditor interfaceType, GlobalItem ownParent)
 {
     if (interfaceType == TypeEditor.ACTIVITY)
     {
         setMovable();
         setLineSnap();
         setEditable();
         setActEdit();
     }
 }
Beispiel #15
0
        public ActStartItem(TypeEditor interfaceType)
            : base(interfaceType)
        {
            Stream   st;
            Assembly a = Assembly.GetExecutingAssembly();

            typeWidget = (int)TypeEvent.ACTIVITY_START;
            st         = a.GetManifestResourceStream("LibAE.Icon.Start.ico");
            StartIcon  = new System.Drawing.Icon(st);
        }
Beispiel #16
0
        public void AcceptsDataTemplateForTemplates()
        {
            DataTemplate template = new DataTemplate();
            Editor       editor   = new TypeEditor {
                InlineTemplate = template, ExtendedTemplate = template, DialogTemplate = template
            };

            Assert.AreEqual(template, editor.InlineTemplate);
            Assert.AreEqual(template, editor.ExtendedTemplate);
            Assert.AreEqual(template, editor.DialogTemplate);
        }
Beispiel #17
0
        public void AcceptsResourceKeyForTemplates()
        {
            ComponentResourceKey key = new ComponentResourceKey();
            Editor editor            = new TypeEditor {
                InlineTemplate = key, ExtendedTemplate = key, DialogTemplate = key
            };

            Assert.AreEqual(key, editor.InlineTemplate);
            Assert.AreEqual(key, editor.ExtendedTemplate);
            Assert.AreEqual(key, editor.DialogTemplate);
        }
Beispiel #18
0
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setMovable();
     }
     if (parent == null)
     {
         parent = (StationItem)ownParent;
     }
 }
Beispiel #19
0
 // Methods
 public AEConfig(TypeEditor type, ActEditor panel, Viewer2D viewer)
 {
     routeData     = panel.routeData;
     AEConfigPanel = panel.activityOverview;
     typeConfig    = type;
     Viewer        = viewer;
     aeRouteConfig = new AERouteConfig(this);
     if (typeConfig == TypeEditor.ACTIVITY)
     {
         aeActivity = new AEActivity();
     }
 }
        static public ORRouteConfig DeserializeJSON(string fileName, TypeEditor interfaceType)
        {
            ORRouteConfig p;

            fileName += ".cfg.json";
            //try
            //{
            // TODO: This code is BROKEN. It loads and saves file formats with internal type information included, which causes breakages if the types are moved. This is not acceptable for public, shared data.
            //JsonSerializer serializer = new JsonSerializer();
            //using (StreamReader sr = new StreamReader(fileName))
            //{
            //    ORRouteConfig orRouteConfig = JsonConvert.DeserializeObject<ORRouteConfig>((string)sr.ReadToEnd(), new JsonSerializerSettings
            //    {
            //        PreserveReferencesHandling = PreserveReferencesHandling.Objects,
            //        TypeNameHandling = TypeNameHandling.Auto
            //    });
            //    p = orRouteConfig;

            //    foreach (var item in p.routeItems)
            //    {
            //        p.AllItems.Add(item);
            //        item.alignEdition(interfaceType, null);
            //        if (item.GetType() == typeof(StationItem))
            //        {
            //            if (((StationItem)item).stationArea.Count > 0)
            //            {
            //                foreach (var item2 in ((StationItem)item).stationArea)
            //                {
            //                    ((StationAreaItem)item2).alignEdition(interfaceType, item);
            //                }
            //                ((StationItem)item).areaCompleted = true;
            //            }
            //        }
            //        else if (item.GetType() == typeof(AEBufferItem))
            //        {
            //        }
            //    }
            //    //orRouteConfig.ReduceItems();
            //}
            //
            //}
            //catch (IOException)
            //{
            p           = new ORRouteConfig();
            p.FileName  = Path.GetFileName(fileName);
            p.RoutePath = Path.GetDirectoryName(fileName);
            p.RouteName = "";
            p.toSave    = true;

            //}
            return(p);
        }
Beispiel #21
0
        public MSTSDataConfig(string mstsPath, string Route, TypeEditor interfaceType) : base(mstsPath, Route)
        {
            orRouteConfig = new ORRouteConfig();
            string routePath = Path.Combine(Route, TRK.Tr_RouteFile.FileName);

            TileBase = new MSTSBase(TDB);
            TileBase.reduce(TDB);
            orRouteConfig = ORRouteConfig.loadConfig(routePath, interfaceType);
            {
                orRouteConfig.SetRouteName(TRK.Tr_RouteFile.Name);
            }
            //Signals = new Signals(this);
        }
Beispiel #22
0
        public void LoadRoute(string routePath, TypeEditor interfaceType)
        {
            Program.actEditor.DisplayStatusMessage("Simulator Loading...");
            mstsDataConfig = new MSTSDataConfig(Program.aePreference.MSTSPath, routePath, interfaceType);
            Program.actEditor.DisplayStatusMessage("Load route Metadata ...");

            orRouteConfig = ORRouteConfig.LoadConfig(TRK.Tr_RouteFile.FileName, routePath, interfaceType);
            //AESignals = new AESignals(this);
            orRouteConfig.SetTraveller(TSectionDat, TDB);
            orRouteConfig.SetTileBase(mstsDataConfig.TileBase);
            orRouteConfig.ReduceItems();

            LoadItemsFromMSTS();
            ReAlignData();
        }
Beispiel #23
0
 public void UnselectTools(TypeEditor viewerMode)
 {
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         cntAct--;
     }
     else if (viewerMode == TypeEditor.ROUTECONFIG)
     {
         cntRoute--;
     }
     else if (viewerMode == TypeEditor.TRAFFIC)
     {
     }
     else
     {
     }
     if (cntAct > 0)
     {
         this.activityCFG.Visible = true;
     }
     else
     {
         cntAct = 0;
         this.activityCFG.Visible = false;
     }
     if (cntRoute > 0)
     {
         this.routeCFG.Visible = true;
     }
     else
     {
         cntRoute = 0;
         this.routeCFG.Visible = false;
     }
     if (cntRoute == 0 && cntAct == 0)
     {
         this.toolStrip3.Visible = false;
     }
     else
     {
         this.toolStrip3.Visible = true;
     }
 }
Beispiel #24
0
        private void DoRefactor(DirectoryInfo rootFolder, DirectoryInfo mirrorFolder)
        {
            foreach (var dir in rootFolder.GetDirectories())
            {
                string        pathNextMirror = mirrorFolder.FullName + "\\" + dir.Name;
                DirectoryInfo nextMirror     = new DirectoryInfo(pathNextMirror);
                nextMirror.Create();
                DoRefactor(dir, nextMirror);
            }
            foreach (var file in rootFolder.GetFiles())
            {
                TypeEditor type           = GetTypeEditor(file.Name);
                var        editor         = factoryEditor.GetEditor((int)type);
                string     pathMirrorFile = mirrorFolder.FullName + "\\" + file.Name;

                if (editor == null)
                {
                    file.CopyTo(pathMirrorFile);
                    continue;
                }

                Action write = () => {
                    Console.WriteLine(file.FullName);
                    string inputText  = File.ReadAllText(file.FullName);
                    string resultText = editor.EditText(inputText);
                    File.WriteAllText(pathMirrorFile, resultText);
                };

                if (type == TypeEditor.Js)
                {
                    queue.Add(write);
                }
                else
                {
                    write();
                }
            }
        }
Beispiel #25
0
 public void ValidatesNotSupportedTemplateValues()
 {
     Editor editor = new TypeEditor(typeof(string), "WRONG_VALUE");
 }
Beispiel #26
0
 public StationAreaItem(TypeEditor interfaceType, StationItem myParent)
 {
     alignEdition(interfaceType, myParent);
     parent = myParent;
 }
Beispiel #27
0
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     setMovable();
 }
Beispiel #28
0
 public TagItem(TypeEditor interfaceType)
 {
     alignEdition(interfaceType, null);
 }
Beispiel #29
0
 public virtual void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
 }
 public PathEventItem(TypeEditor interfaceType)
 {
     typeItem = (int)TypeEvent.ACTIVITY_EVENT;
     alignEdition(interfaceType, null);
 }