Laden...

Profil von Andreas@Tricept

myCSharp.de - Member Mitglied seit
A
Andreas@Tricept
myCSharp.de - Member
125
Themen
289
Beiträge
Dabei seit
06.07.2006
Letzte Aktivität
vor 8 Jahren
Erstellt vor 8 Jahren

Hallo,

für meine Website möchte ich auf der ersten URL Ebene eine Stadt angeben können.
Der Stadtname wäre aber nur der Parameter für mein Stadtcontroller.
Auf der ersten Ebene habe ich ansonsten natürlich auch andere Views und Controllerzugriffe.
Daher kann ich die Erste Ebene ja nicht dynamisch gestalten.

Meine Lösung sieht derzeit so aus:


            using (StadtController c = new StadtController())
            {
                foreach (var city in c.GetAvailableCities())
                {
                    routes.MapRoute(
                        name: city.Name,
                        url: city.Name,
                        defaults: new { controller = "Stadt", action = "Index", city = city.Name }
                    );
                }
            }

Das funktioniert auch, nur ist das der Bestpractice?

Die Alternative


            routes.MapRoute(
                name: "Stadt",
                url: "{city}",
                defaults: new { controller = "Stadt", action = "Index"}
            );

funktioniert dann nur für den Stadtcontroller. Andere Controller die auf die erste Ebene eingeschränkt sind gehen dann nicht.

Habt ihr Tipps für mich?

Erstellt vor 10 Jahren

Die einzigen Pfade die ich eingetippt habe sind doch die hier:

    
    <script src="cordova.js"></script>
    <script src="scripts/angular.js"></script>
    <script src="scripts/angularApp.js"></script>

Die stimmen eigentlich. Cordova ist zwar nicht auf Top-Ebene vorhanden soll aber zur Laufzeit da sein, hab ich zumindest gelesen.
Und meine Datei heisst eigentlich angularApp.ts <- eine Typescript datei, aber im Hintergrund wird doch auch an der Stelle eine js Datei erzeugt die ich referenzieren muss oder?
Oder bin ich auf dem Holzweg. Bitte auch wenn das ein absolutes Newbie Problem ist, ich sehe kein Problem...

Erstellt vor 10 Jahren

Danke für die guten Tipps. Würdest du dann auch empfehlen NodeJs zu verwenden?

Hier der Auszug aus dem Fehlerlog:

Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Failed to load resource: the server responded with a status of 404 (Not Found)
File: favicon.ico, Line: 0, Column: 0
Failed to load resource: the server responded with a status of 404 (Not Found)
File: angular.js, Line: 0, Column: 0
Failed to load resource: the server responded with a status of 404 (Not Found)
File: moment.js, Line: 0, Column: 0
Failed to load resource: the server responded with a status of 404 (Not Found)
File: angular-locale_de.js, Line: 0, Column: 0
Failed to load resource: the server responded with a status of 404 (Not Found)
File: AngularApp.js, Line: 0, Column: 0
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Failed to load resource: the server responded with a status of 404 (Not Found)
File: favicon.ico, Line: 0, Column: 0
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
Failed to load resource: the server responded with a status of 404 (Not Found)
File: favicon.ico, Line: 0, Column: 0
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Failed to load resource: the server responded with a status of 404 (Not Found)
File: favicon.ico, Line: 0, Column: 0
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059
Failed to load resource: the server responded with a status of 404 (Not Found)
File: favicon.ico, Line: 0, Column: 0
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)
File: ripple.js, Line: 37, Column: 13059
cordova :: Initialization Finished (Make it so.)
File: ripple.js, Line: 37, Column: 13059

Erstellt vor 10 Jahren

Hallo,

ich möchte eine Cross-Plattform App schreiben und habe mir schon diverse Tutorials und Videos angeschaut, bekomme es aber auf der grünen Wiese selber nicht hin was ich sehe.
Ich komme aus der C# Welt und habe mir einen Web-API Server Service gebaut und versuche nun mit diesem meine App zu befüllen und zu Starten, stoße doch seit zwei Tagen schon beim Start auf Probleme die ich einfach nicht korregiert kriege.

Ich will daher mal von Anfang an beschreiben was meine Schritte sind:

  1. Ich erstelle ein neues Apache Cordova Projekt in VS2013
  2. Importiere ein paar JavaScript und TypeScript Packe im PM von VS.
    2.1 Install-Package Angular.js
    2.2 Install-Package Angularjs.typescript.definitelytyped
    2.3 Install-Package JQuery.js
    2.4 Install-Package jquery.typescript.definitelytyped
    2.5 Install-Package bootstrap.js
    2.6 Install-Package bootstrap.typescript.definitelytyped
    (Namen aus dem Gedächtnis)
  3. Erstelle ein TypeScript im scripts Ordner mit dem Namen angularApp:

module Snip {

    //ng
    var app = angular.module("Snip", []);
    app.controller("HomeCtrl", function ($scope, $http, $q) {
        $scope.vm = new HomeVM($scope, $http, $q);
    });

    var INTEGER_REGEXP = /^\-?\d*$/;
    app.directive('integer', function () {
        return {
            require: 'ngModel',
            link: function (scope, elm, attrs, ctrl) {
                ctrl.$parsers.unshift(function (viewValue) {
                    if (INTEGER_REGEXP.test(viewValue)) {
                        // it is valid
                        ctrl.$setValidity('integer', true);

                        return viewValue;
                    } else {
                        // it is invalid, return undefined (no model update)
                        ctrl.$setValidity('integer', false);
                        return undefined;
                    }
                });
            }
        };
    });

    export class CategoryVM {
        public Name: string;
        public Description: string;
        public Position: number;
        public Color: number;
        public Id: string;
        public Selected: boolean;

        constructor(category: any) {
            this.Id = category.Id;
            this.Name = category.Name;
            this.Description = category.Description;
            this.Color = category.Color;
            this.Position = category.Position;
        }
    }

    export class HomeVM {

        public categories: Array<CategoryVM> = new Array<CategoryVM>();
        public selectedCategorie: CategoryVM;
        public categoryFilter: string;
        public categoryDescriptionFilter: string;

        private scope: any;
        private http: ng.IHttpService;
        private q: ng.IQService;
        public state: string = "Category";

        public message: string;

        public SetState(state: string) {
            this.state = state;
        }

        constructor(scope: any, http: ng.IHttpService, q: ng.IQService) {
            this.scope = scope;
            this.q = q;
            this.http = http;
        }

        public selectCategory(idx: number) {
            for (var i = 0; i < this.categories.length; i++) {
                var f = this.categories[i];
                if (i == idx) {
                    f.Selected = true;
                    this.selectedCategorie = f;
                }
                else {
                    f.Selected = false;
                }
            }
        }

        private processCategories(p) {
            this.categories = new Array<CategoryVM>();

            if (angular.isArray(p)) {

                for (var i = 0; i < p.length; i++) {
                    var category = p[i];
                    var pVM = new CategoryVM(category);
                    this.categories.push(pVM);
                }
            }
            else {
                var pVM = new CategoryVM(p);
                this.categories.push(pVM);
            }
        }

        public load(): ng.IPromise<any> {
            var defered = this.q.defer<any>();
            var params: any = {};
            var that = this;

            this.http.get("http://localhost:62191/tables/Category")
                .then((result) => {

                var categories = result.data;
                this.processCategories(categories);
                that.scope.$apply();
                defered.resolve(null);
            }).catch((p) => {
                this.message = "Fehler: " + p;
                defered.reject(null);
            });
            return defered.promise;
        }
    }
} 

  1. Passe meine Index.html an:

<!DOCTYPE html>
<html ng-app="Snip">
<head>
    <title>Test</title>
    <script src="cordova.js"></script>
    <script src="scripts/angular.js"></script>
    <script src="scripts/angularApp.js"></script>
</head>
<body>
    <div>
        <table ng-controller="HomeCtrl" ng-show="vm.categories.length &gt; 0">
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Beschr</th>
                <th>Position</th>
            </tr>
            <tr ng-repeat="f in vm.categories" ng-class="{ selected: f.Selected }">
                <td>{{f.Id}}</td>
                <td>{{f.Name}}</td>
                <td>{{f.Description}}</td>
                <td>{{f.Position}}</td>
                <td><a href="#" ng-click="vm.selectCategory($index)">Auswählen</a></td>
            </tr>
        </table>
    </div>
</body>
</html>

  1. Starte die App. Er sagt mir das er alle Resourcen Dateien nicht laden konnte und zeigt mir kein Inhalt an. Was ist falsch? Ich verstehe das nicht. In die Script datei springt er nicht. Ich habe da diverse Breakpoints eingebaut...
Erstellt vor 10 Jahren

Zur Info: Ich habe eine Möglichkeit gefunden. Man kann bei den DataPoints der jeweiligen Series die X-Position bestimmen. Diese lässt sich auch als Gleitkommazahl definieren, was dann eine überlappung zur Folge hat.
Thema ist also durch. Außer jemand kennt eine einfachere Lösung, als es selbst zu berechnen.

Erstellt vor 10 Jahren

Hallo,

ich habe Probleme beim MS Chart eine Überlappung/Uberlagerung der Balken hinzubekommen, so wie es auch im Excel möglich ist. Habe ein Screen beigefügt.

Kann man das irgenwie einstellen bzw. kann man die Abstände der Balken einstellen oder die Position wo die Balken jeweils liegen auf der X-Achse?

Grüße
Andreas

Erstellt vor 11 Jahren

Danke für die Lösung ! 👍

Hier die Lösung im Code:


            chart2.Series[0].Points.Add(10);
            chart2.Series[0].Points.Add(20);
            chart2.Series[0].Points.Add(30);
            chart2.Series[0].Points.Add(25);

            chart2.ChartAreas[0].AxisX.CustomLabels.Add(0, 2.5, "Hannover", 1, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);
            chart2.ChartAreas[0].AxisX.CustomLabels.Add(2.5, 5, "Berlin", 1, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);
            chart2.ChartAreas[0].AxisX.CustomLabels.Add(0, 2, "Hauptstr", 0, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);
            chart2.ChartAreas[0].AxisX.CustomLabels.Add(1, 3, "Bahnhofstr", 0, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);
            chart2.ChartAreas[0].AxisX.CustomLabels.Add(2, 4, "Königsweg", 0, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);
            chart2.ChartAreas[0].AxisX.CustomLabels.Add(3, 5, "Hofstr", 0, System.Windows.Forms.DataVisualization.Charting.LabelMarkStyle.Box);

Erstellt vor 11 Jahren

Hallo,

kurze Frage, hoffe ich 😉.
Ich habe bisher keine Möglichkeit gefunden beim
System.Windows.Forms.DataVisualization.Charting.Chart die X-Achse Labels zu gruppieren wie es in Excel sonst geht. Siehe Bild.

Weiss jemand ob diese Möglichkeit existiert?

Erstellt vor 11 Jahren

Hallo,

ich habe das Problem das ich an irgendeiner Stelle nicht korrekt User-Controls freigebe (dispose). Dadurch wächst die Anzahl an Benutzerobjekten bei Laufzeit des Betriebes stetig an. Ich finde nur diese Stelle nicht. Gibt es eine Möglichkeit diese User-Control die kein Parent haben aber auch nicht disposed sind zu ermitteln.
Also vielleicht auch alle erstellten Controls der Anwendung irgendwie zu sammeln, damit ich mir die mal anschauen kann? Kennt ihr da einen Ansatz?

Viele Grüße
Andreas

Erstellt vor 11 Jahren

Hallo zusammen,

wir vertreiben eine Software mit Excelanbindung. Ein Kunde hat Excel 2003 im Einsatz und hat auf 2010 gewechselt und bekommt nun die im Anhang verzeichnete Fehlermeldung.

Es gab bereits andere Kunden die gewechselt haben und wir versuchen auch das Problem nachzustellen, bekommen das aber nicht hin.

Wir haben die Interop-DLL's nochmals ausgeliefert, die Office PIA's für 2010 nachinstalliert, aber uns fehlt gerade der Ansatz was falsch sein könnte...

Habt ihr vielleicht irgendeine Idee wo man weiter ansetzen kann?