public VersionInfoEditor([NotNull]AcJsonObjectNew acObj) {
            InitializeComponent();
            DataContext = this;

            Buttons = new [] { OkButton, CancelButton };
            AcObj = acObj;

            Closing += VersionInfoEditor_Closing;
        }
        public FindInformationDialog(AcJsonObjectNew obj) {
            DataContext = new ViewModel(obj);
            InitializeComponent();

            Buttons = new[] {
                CreateExtraDialogButton(ControlsStrings.FindInformation_SaveAndClose, new CombinedCommand(Model.SaveCommand, CloseCommand)),
                CloseButton
            };

            WebBrowser.SetScriptProvider(new ScriptProvider(Model));
        }
Example #3
0
        public static MultiSolution TryToCreateNewFile(AcJsonObjectNew target) {
            if (target is ShowroomObject) {
                return new MultiSolution(
                    ToolsStrings.Solving_CreateNewFile,
                    ToolsStrings.Solving_CreateNewFile_Commentary,
                    e => {
                        var jObject = new JObject {
                            [@"name"] = AcStringValues.NameFromId(e.Target.Id)
                        };

                        FileUtils.EnsureFileDirectoryExists(((AcJsonObjectNew)e.Target).JsonFilename);
                        File.WriteAllText(((AcJsonObjectNew)e.Target).JsonFilename, jObject.ToString());
                    });
            }

            if (target is CarSkinObject) {
                return new MultiSolution(
                    ToolsStrings.Solving_CreateNewFile,
                    ToolsStrings.Solving_CreateNewFile_Commentary,
                    e => {
                        var jObject = new JObject {
                            [@"skinname"] = CarSkinObject.NameFromId(e.Target.Id),
                            [@"drivername"] = "",
                            [@"country"] = "",
                            [@"team"] = "",
                            [@"number"] = @"0"
                        };

                        if (!SettingsHolder.Content.SkinsSkipPriority) {
                            jObject[@"priority"] = 1;
                        }

                        FileUtils.EnsureFileDirectoryExists(((AcJsonObjectNew)e.Target).JsonFilename);
                        File.WriteAllText(((AcJsonObjectNew)e.Target).JsonFilename, jObject.ToString());
                    });
            }

            return null;
        }
        public static JObjectRestorationScheme GetScheme(AcJsonObjectNew target) {
            if (target is ShowroomObject) {
                return new JObjectRestorationScheme(
                    new JObjectRestorationScheme.Field("name", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("country", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("description", JObjectRestorationScheme.FieldType.StringMultiline),
                    new JObjectRestorationScheme.Field("tags", JObjectRestorationScheme.FieldType.StringsArray),

                    new JObjectRestorationScheme.Field("year", JObjectRestorationScheme.FieldType.Number),
                    new JObjectRestorationScheme.Field("author", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("url", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("version", JObjectRestorationScheme.FieldType.String)
                );
            }

            if (target is CarObject) {
                return new JObjectRestorationScheme(
                    new JObjectRestorationScheme.Field("name", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("brand", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("class", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("country", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("description", JObjectRestorationScheme.FieldType.StringMultiline),
                    new JObjectRestorationScheme.Field("tags", JObjectRestorationScheme.FieldType.StringsArray),

                    new JObjectRestorationScheme.Field("torqueCurve", JObjectRestorationScheme.FieldType.PairsArray),
                    new JObjectRestorationScheme.Field("powerCurve", JObjectRestorationScheme.FieldType.PairsArray),

                    new JObjectRestorationScheme.Field("bhp", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("torque", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("weight", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("topspeed", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("acceleration", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("pwratio", "specs", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("range", "specs", JObjectRestorationScheme.FieldType.String),

                    new JObjectRestorationScheme.Field("year", JObjectRestorationScheme.FieldType.Number),
                    new JObjectRestorationScheme.Field("author", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("url", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("version", JObjectRestorationScheme.FieldType.String)
                );
            }

            if (target is TrackObject) {
                return new JObjectRestorationScheme(
                    new JObjectRestorationScheme.Field("name", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("description", JObjectRestorationScheme.FieldType.StringMultiline),
                    new JObjectRestorationScheme.Field("tags", JObjectRestorationScheme.FieldType.StringsArray),
                    new JObjectRestorationScheme.Field("geotags", JObjectRestorationScheme.FieldType.StringsArray),

                    new JObjectRestorationScheme.Field("country", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("city", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("length", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("width", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("pitboxes", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("run", JObjectRestorationScheme.FieldType.String),

                    new JObjectRestorationScheme.Field("year", JObjectRestorationScheme.FieldType.Number),
                    new JObjectRestorationScheme.Field("author", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("url", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("version", JObjectRestorationScheme.FieldType.String)
                );
            }

            if (target is CarSkinObject) {
                return new JObjectRestorationScheme(
                    new JObjectRestorationScheme.Field("skinname", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("drivername", JObjectRestorationScheme.FieldType.NonNullString),
                    new JObjectRestorationScheme.Field("country", JObjectRestorationScheme.FieldType.NonNullString),
                    new JObjectRestorationScheme.Field("team", JObjectRestorationScheme.FieldType.NonNullString),
                    new JObjectRestorationScheme.Field("number", JObjectRestorationScheme.FieldType.NonNullString),
                    new JObjectRestorationScheme.Field("priority", JObjectRestorationScheme.FieldType.Number),

                    new JObjectRestorationScheme.Field("year", JObjectRestorationScheme.FieldType.Number),
                    new JObjectRestorationScheme.Field("author", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("url", JObjectRestorationScheme.FieldType.String),
                    new JObjectRestorationScheme.Field("version", JObjectRestorationScheme.FieldType.String)
                );
            }

            throw new NotImplementedException();
        }
 public ViewModel(AcJsonObjectNew selectedObject) {
     SelectedObject = selectedObject;
     StartPage = GetMapAddress(SelectedObject);
 }