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

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

            return(loaded);
        }
コード例 #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);
        }
コード例 #5
0
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setMovable();
         setRotable();
     }
 }
コード例 #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);
        }
コード例 #7
0
 public override void alignEdition(TypeEditor interfaceType, GlobalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setEditable();
         asMetadata = true;
     }
     parentStation = (StationItem)ownParent;
 }
コード例 #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)));
        }
コード例 #9
0
 public void UnsetFocus(TypeEditor viewerMode)
 {
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         AEConfigPanel.SuspendLayout();
         AEConfigPanel.Visible = false;
     }
     routeData.SuspendLayout();
     routeData.Visible = false;
 }
コード例 #10
0
        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);
        }
コード例 #11
0
 public void Close(TypeEditor viewerMode)
 {
     aeRouteConfig.CloseRoute();
     routeData.Visible = false;
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         aeActivity.ClosegActivity();
         AEConfigPanel.Visible = false;
     }
 }
コード例 #12
0
ファイル: FactoryEditor.cs プロジェクト: Nevors/CourseWork
        public ITextEditor GetEditor(int type)
        {
            TypeEditor typeEditor = (TypeEditor)type;

            if (editors.ContainsKey(typeEditor))
            {
                return(editors[typeEditor]);
            }
            return(null);
        }
コード例 #13
0
 public void SetFocus(TypeEditor viewerMode)
 {
     if (viewerMode == TypeEditor.ACTIVITY)
     {
         AEConfigPanel.Visible = true;
         AEConfigPanel.ResumeLayout(false);
     }
     routeData.Visible = true;
     routeData.ResumeLayout(false);
 }
コード例 #14
0
 public override void alignEdition(TypeEditor interfaceType, GlobalItem ownParent)
 {
     if (interfaceType == TypeEditor.ACTIVITY)
     {
         setMovable();
         setLineSnap();
         setEditable();
         setActEdit();
     }
 }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #18
0
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     if (interfaceType == TypeEditor.ROUTECONFIG)
     {
         setMovable();
     }
     if (parent == null)
     {
         parent = (StationItem)ownParent;
     }
 }
コード例 #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();
     }
 }
コード例 #20
0
        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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #23
0
ファイル: ActEditor.cs プロジェクト: xiaomailong/OpenRails
 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;
     }
 }
コード例 #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();
                }
            }
        }
コード例 #25
0
 public void ValidatesNotSupportedTemplateValues()
 {
     Editor editor = new TypeEditor(typeof(string), "WRONG_VALUE");
 }
コード例 #26
0
 public StationAreaItem(TypeEditor interfaceType, StationItem myParent)
 {
     alignEdition(interfaceType, myParent);
     parent = myParent;
 }
コード例 #27
0
 public override void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
     setMovable();
 }
コード例 #28
0
 public TagItem(TypeEditor interfaceType)
 {
     alignEdition(interfaceType, null);
 }
コード例 #29
0
 public virtual void alignEdition(TypeEditor interfaceType, globalItem ownParent)
 {
 }
コード例 #30
0
 public PathEventItem(TypeEditor interfaceType)
 {
     typeItem = (int)TypeEvent.ACTIVITY_EVENT;
     alignEdition(interfaceType, null);
 }