Inheritance: System.EventArgs
Esempio n. 1
0
 void menu_Selected(object sender, MenuSelectedEventArgs e)
 {
     Value = e.Object.ToString();
     if (ShowValue) Content = Value;
     RaiseValueChangedEvent();
 }
Esempio n. 2
0
 private void MenuSelected(object sender, MenuSelectedEventArgs e) {
     var endpoint = e.Object as EndPoint;
     if (endpoint != null) {
         endpoint.Contract.Send(endpoint, this);
     }
 }
        // TODO EV When the service has been created, I can add pois to it. On closing the app, it saves the pois too. But when restarting, it doesn't show them anymore, nor can I add new pois.
        // TODO EV Every time I create a new service, it shows in the popup. Actually, I only want to show actual templates, which I shouldn't be able to remove.

        /// <summary>
        /// Create a new service based on an existing one..
        /// </summary>
        /// <param name="args"></param>
        private async void CreateNewService(MenuSelectedEventArgs args) {
            var selectedServiceName = args.Object.ToString().Trim(new[] {' ', '*'});
            if (string.Equals(CreateNewLayerString, selectedServiceName)) return;
            var selectedService = Plugin.Dsb.Templates.FirstOrDefault(s => Equals(s.Name, selectedServiceName));
            if (selectedService == null) return;
            var i = 1;
            var newServiceName = selectedServiceName + i;
            while (Plugin.Dsb.Services.Any(s => Equals(s.Name, newServiceName))) newServiceName = selectedServiceName + ++i;

            var folder = Path.GetDirectoryName(selectedService.FileName);
            // Make sure you save it, otherwise you cannot subscribe to it.
            var clonedFile = await PoiService.GetCleanClone(folder, selectedServiceName + ".dsd", folder, newServiceName);
            if (string.IsNullOrEmpty(clonedFile)) return;
            var clonedDataService = AppStateSettings.Instance.DataServer.AddLocalDataService(folder, Mode.client, clonedFile,autoStart:true);
            
            //clonedDataService.IsFileBased = true;
            //clonedDataService.IsLocal = true;
            //clonedDataService.PoITypes.IsRessetable = true;
            //var settings = clonedDataService.AllContent.FirstOrDefault(c => c.Count > 0 && c[0] is ServiceSettings);
            //if (settings != null) settings.IsRessetable = true;
            //Plugin.Dsb.AddService(clonedDataService, Mode.client);
            //Plugin.Dsb.Subscribe(clonedDataService);
        }