• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ValueSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ValueSet的典型用法代码示例。如果您正苦于以下问题:C# ValueSet类的具体用法?C# ValueSet怎么用?C# ValueSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValueSet类属于命名空间,在下文中一共展示了ValueSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LaunchUriForResult_Click

		private async void LaunchUriForResult_Click(object sender, RoutedEventArgs e)
		{
			var protocol = "win10demo2://";
			var packageFamilyName = "0df93276-6bbb-46fa-96b7-ec223e226505_cb1hhkscw5m06";
			var status = await Launcher.QueryUriSupportAsync(new Uri(protocol), LaunchQuerySupportType.UriForResults, packageFamilyName);
			if (status == LaunchQuerySupportStatus.Available)
			{
				var options = new LauncherOptions
				{
					TargetApplicationPackageFamilyName = packageFamilyName
				};
				var values = new ValueSet();
				values.Add("TwitterId", "danvy");
				var result = await Launcher.LaunchUriForResultsAsync(new Uri(protocol), options, values);
				if (result.Status == LaunchUriStatus.Success)
				{
					var authorized = result.Result["Authorized"] as string;
					if (authorized == true.ToString())
					{
						var dialog = new MessageDialog("You are authorized :)");
						await dialog.ShowAsync();
					}
				}
			}
		}
开发者ID:ericzile,项目名称:win10demo,代码行数:25,代码来源:LauncherView.xaml.cs


示例2: InitializeAppSvc

        private async void InitializeAppSvc()
        {
            string WebServerStatus = "PoolWebServer failed to start. AppServiceConnectionStatus was not successful.";

            // Initialize the AppServiceConnection
            appServiceConnection = new AppServiceConnection();
            appServiceConnection.PackageFamilyName = "PoolWebServer_hz258y3tkez3a";
            appServiceConnection.AppServiceName = "App2AppComService";

            // Send a initialize request 
            var res = await appServiceConnection.OpenAsync();
            if (res == AppServiceConnectionStatus.Success)
            {
                var message = new ValueSet();
                message.Add("Command", "Initialize");
                var response = await appServiceConnection.SendMessageAsync(message);
                if (response.Status != AppServiceResponseStatus.Success)
                {
                    WebServerStatus = "PoolWebServer failed to start.";
                    throw new Exception("Failed to send message");
                }
                appServiceConnection.RequestReceived += OnMessageReceived;
                WebServerStatus = "PoolWebServer started.";
            }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                txtWebServerStatus.Text = WebServerStatus;
            });
        }
开发者ID:mmackes,项目名称:Windows-10-IoT-PoolController,代码行数:30,代码来源:MainPage.xaml.cs


示例3: AddBook

 private ValueSet AddBook(string book)
 {
     BooksRepository.Instance.AddBook(book.ToBook());
     var result = new ValueSet();
     result.Add("result", "ok");
     return result;
 }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:7,代码来源:BooksCacheTask.cs


示例4: OnNavigatedTo

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            Loading.IsActive = true;
            AppServiceConnection connection = new AppServiceConnection();
            connection.PackageFamilyName = Package.Current.Id.FamilyName;
            connection.AppServiceName = "FeedParser";

            var status = await connection.OpenAsync();

            if (status == AppServiceConnectionStatus.Success)
            {
                ValueSet data = new ValueSet();
                data.Add("FeedUrl", "http://blog.qmatteoq.com/feed/");

                var response = await connection.SendMessageAsync(data);
                if (response.Status == AppServiceResponseStatus.Success)
                {
                    string items = response.Message["FeedItems"].ToString();
                    var result = JsonConvert.DeserializeObject<List<FeedItem>>(items);
                    News.ItemsSource = result;
                }
            }

            Loading.IsActive = false;
        }
开发者ID:qmatteoq,项目名称:dotNetSpainConference2016,代码行数:25,代码来源:MainPage.xaml.cs


示例5: NotifyClientsOfPerimeterState

        private async Task NotifyClientsOfPerimeterState()
        {
            var _sensorCurrentValue = _sensorPin.Read();
            var messages = new ValueSet(); //name value pair

            if (_sensorCurrentValue == GpioPinValue.High)
            {
                //send perimeter breached
                messages.Add("Perimeter Notification", "Breached");
            }
            else
            {
                //send perimeter secure
                messages.Add("Perimeter Notification", "Secure");
            }

            //send message to the client
            var response = await _connection.SendMessageAsync(messages);

            if (response.Status == AppServiceResponseStatus.Success)
            {
                var result = response.Message["Response"];
                //optionally log result from client
            }
        }
开发者ID:falafelsoftware,项目名称:InterApplicationCommunication,代码行数:25,代码来源:PerimeterBreachAppService.cs


示例6: Accept_Click

        private void Accept_Click(object sender, RoutedEventArgs e)
        {
            ValueSet result = new ValueSet();
            result["Status"] = "Success";
			result["ProductName"] = productName;
            operation.ReportCompleted(result);
        }
开发者ID:webbgr,项目名称:Build2015,代码行数:7,代码来源:PaymentPage.xaml.cs


示例7: InitializeService

        private async void InitializeService()
        {
            _appServiceConnection = new AppServiceConnection
            {
                PackageFamilyName = "ConnectionService-uwp_5gyrq6psz227t",
                AppServiceName = "App2AppComService"
            };

            // Send a initialize request 
            var res = await _appServiceConnection.OpenAsync();
            if (res == AppServiceConnectionStatus.Success)
            {
                var message = new ValueSet {{"Command", "Connect"}};

                var response = await _appServiceConnection.SendMessageAsync(message);
                if (response.Status == AppServiceResponseStatus.Success)
                {
                    InitializeSerialBridge();
                    //InitializeBluetoothBridge();
                    _appServiceConnection.RequestReceived += _serialBridge.OnCommandRecived;
                    //_appServiceConnection.RequestReceived += _bluetoothBridge.OnCommandRecived;
                    //_appServiceConnection.RequestReceived += _appServiceConnection_RequestReceived;
                    
                }
            }
        }
开发者ID:Quantzo,项目名称:IotRouter,代码行数:26,代码来源:StartupTask.cs


示例8: CallService_Click

		private async void CallService_Click(object sender, RoutedEventArgs e)
		{
			var connection = new AppServiceConnection();
			connection.PackageFamilyName = "041cdcf9-8ef3-40e4-85e2-8f3de5e06155_ncrzdc1cmma1g"; // Windows.ApplicationModel.Package.Current.Id.FamilyName;
			connection.AppServiceName = "CalculatorService";
			var status = await connection.OpenAsync();
			if (status != AppServiceConnectionStatus.Success)
			{
				var dialog = new MessageDialog("Sorry, I can't connect to the service right now :S");
				await dialog.ShowAsync();
				return;
			}
			var message = new ValueSet();
			message.Add("service", (OperatorCombo.SelectedValue as ComboBoxItem).Content);
			message.Add("a", Convert.ToInt32(ValueABox.Text));
			message.Add("b", Convert.ToInt32(ValueBBox.Text));
			AppServiceResponse response = await connection.SendMessageAsync(message);
			if (response.Status == AppServiceResponseStatus.Success)
			{
				if (response.Message.ContainsKey("result"))
				{
					ResultBlock.Text = response.Message["result"].ToString();
				}
			}
			else
			{
				var dialog = new MessageDialog(string.Format("Opps, I just get an error :S ({0})", response.Status));
				await dialog.ShowAsync();
			}
		}
开发者ID:oudoulj,项目名称:win10demo,代码行数:30,代码来源:LauncherView.xaml.cs


示例9: Connection_RequestReceived

 private async void Connection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
 {
     var deferral = args.GetDeferral();
     var response = new ValueSet();
     bool stop = false;
     try
     {
         var request = args.Request;
         var message = request.Message;
         if (message.ContainsKey(BackgroundOperation.NewBackgroundRequest))
         {
             switch ((BackgroundRequest)message[BackgroundOperation.NewBackgroundRequest])
             {
                 default:
                     stop = true;
                     break;
             }
         }
     }
     finally
     {
        
         if (stop)
         {
             _deferral.Complete();
         }
     }
 }
开发者ID:bospoort,项目名称:Windows-universal-samples,代码行数:28,代码来源:AppService.cs


示例10: LaunchAsync

        /// <summary>
        /// Launch the pick'n'crop task
        /// </summary>
        /// <returns>In case of success, a cropped image saved in StorageFile</returns>
        public async Task<StorageFile> LaunchAsync()
        {
            if (CropWidthPixels <= 0 || CropHeightPixels <= 0)
            {
                throw new ArgumentException("Cannot crop an image with zero or null dimension",
                    CropWidthPixels <= 0 ? "CropWidthPixels" : "CropHeightPixels");
            }

            var storageAssembly = typeof(Windows.ApplicationModel.DataTransfer.DataPackage).GetTypeInfo().Assembly;

            var storageManagerType =
                storageAssembly.GetType("Windows.ApplicationModel.DataTransfer.SharedStorageAccessManager");

            var token =
                storageManagerType.GetTypeInfo()
                    .DeclaredMethods.FirstOrDefault(m => m.Name == "AddFile")
                    .Invoke(storageManagerType, new object[] {OutputFile});

            var parameters = new ValueSet
            {
                {"CropWidthPixels", CropWidthPixels},
                {"CropHeightPixels", CropHeightPixels},
                {"EllipticalCrop", EllipticalCrop},
                {"ShowCamera", ShowCamera},
                {"DestinationToken", token}
            };

            var launcherAssembly = typeof(Launcher).GetTypeInfo().Assembly;

            var optionsType = launcherAssembly.GetType("Windows.System.LauncherOptions");

            var options = Activator.CreateInstance(optionsType);

            var targetProperty = options.GetType().GetRuntimeProperty("TargetApplicationPackageFamilyName");

            targetProperty.SetValue(options, "Microsoft.Windows.Photos_8wekyb3d8bbwe");

            var launcherType = launcherAssembly.GetType("Windows.System.Launcher");

            var launchUriResult = launcherAssembly.GetType("Windows.System.LaunchUriResult");

            var asTask = GetAsTask();

            var t = asTask.MakeGenericMethod(launchUriResult);

            var method = launcherType.GetTypeInfo()
                .DeclaredMethods.FirstOrDefault(
                    m => m.Name == "LaunchUriForResultsAsync" && m.GetParameters().Length == 3);

            var mt = method.Invoke(launcherType,
                new[] { new Uri("microsoft.windows.photos.crop:"), options, parameters });

            var task = t.Invoke(launcherType, new [] { mt });

            var result = await (dynamic)task;

            string statusStr = result.Status.ToString();

            return statusStr.Contains("Success") ? OutputFile : null;
        }
开发者ID:thunderluca,项目名称:ThresholdPhotoTask,代码行数:64,代码来源:ThresholdPhotoTask.cs


示例11: LaunchUriForResult_Click

		private async void LaunchUriForResult_Click(object sender, RoutedEventArgs e)
		{
			var protocol = "win10demo2://";
			var packageFamilyName = "041cdcf9-8ef3-40e4-85e2-8f3de5e06155_ncrzdc1cmma1g";
			var status = await Launcher.QueryUriSupportAsync(new Uri(protocol), LaunchQuerySupportType.UriForResults, packageFamilyName);
			if (status == LaunchQuerySupportStatus.Available)
			{
				var options = new LauncherOptions
				{
					TargetApplicationPackageFamilyName = packageFamilyName
				};
				var values = new ValueSet();
				values.Add("TwitterId", "danvy");
				var result = await Launcher.LaunchUriForResultsAsync(new Uri(protocol), options, values);
				if ((result.Status == LaunchUriStatus.Success) && (result.Result != null))
				{
					var authorized = result.Result["Authorized"] as string;
					if (authorized == true.ToString())
					{
						var dialog = new MessageDialog("You are authorized :)");
						await dialog.ShowAsync();
					}
				}
			}
		}
开发者ID:oudoulj,项目名称:win10demo,代码行数:25,代码来源:LauncherView.xaml.cs


示例12: GetBeersByFilter

        public async Task<IEnumerable<Beer>> GetBeersByFilter(string filter)
        {
            AppServiceConnection connection = new AppServiceConnection();
            connection.AppServiceName = "PlainConcepts-appservicesdemo";
            connection.PackageFamilyName = "cff6d46b-5839-4bb7-a1f2-e59246de63b3_cb1hhkscw5m06";
            AppServiceConnectionStatus connectionStatus = await connection.OpenAsync();

            if (connectionStatus == AppServiceConnectionStatus.Success)
            {
                //Send data to the service
                var message = new ValueSet();
                message.Add("Command", "GetBeersByFilter");
                message.Add("Filter", filter);

                //Send message and wait for response   
                AppServiceResponse response = await connection.SendMessageAsync(message);
                if (response.Status == AppServiceResponseStatus.Success)
                {
                    var resultJson = (string)response.Message["Result"];
                    var list = JsonConvert.DeserializeObject<IEnumerable<Beer>>(resultJson);
                    return list;
                }
            }
            else
            {
                //Drive the user to store to install the app that provides the app service 
                new MessageDialog("Service not installed").ShowAsync();
            }

            return null;
        }
开发者ID:acasquete,项目名称:app-to-app-uwp,代码行数:31,代码来源:InventoryService.cs


示例13: GetEmployeeById

        private async void GetEmployeeById(object sender, RoutedEventArgs e)
        {

            appServiceConnection = new AppServiceConnection
            {
                AppServiceName = "EmployeeLookupService",
                PackageFamilyName = "3598a822-2b34-44cc-9a20-421137c7511f_4frctqp64dy5c"
            };

            var status = await appServiceConnection.OpenAsync();

            switch (status)
            {
                case AppServiceConnectionStatus.AppNotInstalled:
                    await LogError("The EmployeeLookup application is not installed. Please install it and try again.");
                    return;
                case AppServiceConnectionStatus.AppServiceUnavailable:
                    await LogError("The EmployeeLookup application does not have the available feature");
                    return;
                case AppServiceConnectionStatus.AppUnavailable:
                    await LogError("The package for the app service to which a connection was attempted is unavailable.");
                    return;
                case AppServiceConnectionStatus.Unknown:
                    await LogError("Unknown Error.");
                    return;
            }

            var items = this.EmployeeId.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            var message = new ValueSet();

            for (int i = 0; i < items.Length; i++)
            {
                message.Add(i.ToString(), items[i]);
            }

            var response = await appServiceConnection.SendMessageAsync(message);

            switch (response.Status)
            {
                case AppServiceResponseStatus.ResourceLimitsExceeded:
                    await LogError("Insufficient resources. The app service has been shut down.");
                    return;
                case AppServiceResponseStatus.Failure:
                    await LogError("Failed to receive response.");
                    return;
                case AppServiceResponseStatus.Unknown:
                    await LogError("Unknown error.");
                    return;
            }

            foreach (var item in response.Message)
            {
                this.Items.Add(new Employee
                {
                    Id = item.Key,
                    Name = item.Value.ToString()
                });
            }
        }
开发者ID:MaedaNoriyuki,项目名称:WinDevHOLs,代码行数:60,代码来源:MainPage.xaml.cs


示例14: CallService_Click

		private async void CallService_Click(object sender, RoutedEventArgs e)
		{
			var connection = new AppServiceConnection();
			connection.PackageFamilyName = "0df93276-6bbb-46fa-96b7-ec223e226505_cb1hhkscw5m06"; // Windows.ApplicationModel.Package.Current.Id.FamilyName;
			connection.AppServiceName = "CalculatorService";
			var status = await connection.OpenAsync();
			if (status != AppServiceConnectionStatus.Success)
			{
				var dialog = new MessageDialog("Sorry, I can't connect to the service right now :S");
				await dialog.ShowAsync();
				return;
			}
			var message = new ValueSet();
			message.Add("service", OperatorCombo.Items[OperatorCombo.SelectedIndex]);
			message.Add("a", Convert.ToInt32(ValueABox.Text));
			message.Add("b", Convert.ToInt32(ValueBBox.Text));
			AppServiceResponse response = await connection.SendMessageAsync(message);
			if (response.Status == AppServiceResponseStatus.Success)
			{
				if (response.Message.ContainsKey("result"))
				{
					ResultBlock.Text = response.Message["result"] as string;
				}
			}
			else
			{
				var dialog = new MessageDialog(string.Format("Opps, I just get an error :S ({0})", response.Status));
				await dialog.ShowAsync();
			}
		}
开发者ID:ericzile,项目名称:win10demo,代码行数:30,代码来源:LauncherView.xaml.cs


示例15: Run

        /// <summary>
        /// Hệ thống gọi đến hàm này khi association backgroundtask được bật
        /// </summary>
        /// <param name="taskInstance"> hệ thống tự tạo và truyền vào đây</param>
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            //System.Diagnostics.Debug.WriteLine("background run");
            taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(BackgroundTaskCanceled);
            taskInstance.Task.Completed += new BackgroundTaskCompletedEventHandler(BackgroundTaskCompleted);
            _backgroundstarted.Set();//
            _deferral = taskInstance.GetDeferral();

            //Playlist = new BackgroundPlaylist();
            _smtc = initSMTC();


            this._foregroundState = this.initForegroundState();

            BackgroundMediaPlayer.Current.CurrentStateChanged += BackgroundMediaPlayer_CurrentStateChanged;
            //Playlist = await BackgroundPlaylist.LoadBackgroundPlaylist("playlist.xml");
            Playlist = new BackgroundPlaylist();
            Playlist.ListPathsource = await BackgroundPlaylist.LoadCurrentPlaylist(Constant.CurrentPlaylist);
            
            if (_foregroundState != eForegroundState.Suspended)
            {
                ValueSet message = new ValueSet();
                message.Add(Constant.BackgroundTaskStarted, "");
                BackgroundMediaPlayer.SendMessageToForeground(message);
            }  
            Playlist.TrackChanged += Playlist_TrackChanged;
            BackgroundMediaPlayer.MessageReceivedFromForeground += BackgroundMediaPlayer_MessageReceivedFromForeground;
            BackgroundMediaPlayer.Current.MediaEnded +=Current_MediaEnded;
            ApplicationSettingHelper.SaveSettingsValue(Constant.BackgroundTaskState, Constant.BackgroundTaskRunning);
            isbackgroundtaskrunning = true;
            _loopState = eLoopState.None;
        }
开发者ID:7ung,项目名称:MediaPlayer,代码行数:36,代码来源:BackgroundTask.cs


示例16: CheckOut

        private async Task CheckOut()
        {
            var checkoutAppUri = new Uri("checkoutdemo:");

            // We want a specific app to perform our checkout operation, not just any that implements the protocol we're using for launch
            var options = new LauncherOptions();
            options.TargetApplicationPackageFamilyName = "7d7072f5-7a53-47f6-9932-97647aad9550_z5jhcbv2wstvg";

            var transactionId = Guid.NewGuid().ToString();

            var inputData = new ValueSet();

            // Our collection is too complicated for ValueSet to understand so we serialize it first
            var serializedSelectedItems = JsonConvert.SerializeObject(this.AvailableProducts.Where(p => p.IsSelected).Select(p => new { Description = p.Name, UnitPrice = p.Price, Quantity = 1 }).ToList());

            inputData["Items"] = serializedSelectedItems;
            inputData["Transaction"] = transactionId;

            var response = await Launcher.LaunchUriForResultsAsync(checkoutAppUri, options, inputData);
            if (response.Status == LaunchUriStatus.Success)
            {
                Frame.Navigate(typeof(Receipt), response.Result);
            }
            else
            {
                // TODO: handle failure to launch...
            }
        }
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:28,代码来源:MainPageViewModel.cs


示例17: Connection_RequestReceived

		private async void Connection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
		{
			var lDeferral = args.GetDeferral();
			try
			{
				var message = args.Request.Message;
				if(message.ContainsKey("MessageType") && message.ContainsKey("Message"))
				{
					var type = message["MessageType"] as String;
					var mes = message["Message"] as String;
					if(type != null && mes != null)
					{
						using(var lh = new LoggingHelper())
						{
							var result = lh.LogEntry(type, mes);
							var vs = new ValueSet();
							vs["result"] = result;
							await args.Request.SendResponseAsync(vs);
						}
					}
				}
			}
			catch { }
			lDeferral.Complete();	
		}
开发者ID:holtsoftware,项目名称:House,代码行数:25,代码来源:LoggingAppService.cs


示例18: SendMessageAsync

        private async Task<string> SendMessageAsync(ValueSet message)
        {
            using (var connection = new AppServiceConnection())
            {
                connection.AppServiceName = BookServiceName;
                connection.PackageFamilyName = BooksPackageName;

                AppServiceConnectionStatus status = await connection.OpenAsync();
                if (status == AppServiceConnectionStatus.Success)
                {
                    AppServiceResponse response = await connection.SendMessageAsync(message);
                    if (response.Status == AppServiceResponseStatus.Success && response.Message.ContainsKey("result"))
                    {
                        string result = response.Message["result"].ToString();
                        return result;
                    }
                    else
                    {
                        await ShowServiceErrorAsync(response.Status);
                    }

                }
                else
                {
                    await ShowConnectionErrorAsync(status);
                }

                return string.Empty;
            }
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:30,代码来源:BooksViewModel.cs


示例19: Decline_Click

        private void Decline_Click(object sender, RoutedEventArgs e)
        {
            ValueSet result = new ValueSet();
            result["Status"] = "Cancelled";
			result["ProductName"] = productName;
			operation.ReportCompleted(result);
        }
开发者ID:webbgr,项目名称:Build2015,代码行数:7,代码来源:PaymentPage.xaml.cs


示例20: OnRequestReceived

        private async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
        {
            var message = args.Request.Message;
            string command = message["Command"] as string;

            switch (command)
            {
                case "Initialize":
                    var messageDeferral = args.GetDeferral();
                    //Set a result to return to the caller
                    var returnMessage = new ValueSet();
                    HttpServer server = new HttpServer(8000, appServiceConnection);
                    IAsyncAction asyncAction = Windows.System.Threading.ThreadPool.RunAsync(
                        (workItem) =>
                        {
                            server.StartServer();
                        });
                    returnMessage.Add("Status", "Success");
                    var responseStatus = await args.Request.SendResponseAsync(returnMessage);
                    messageDeferral.Complete();
                    break;
                case "Quit":
                    //Service was asked to quit. Give us service deferral
                    //so platform can terminate the background task
                    serviceDeferral.Complete();
                    break;
            }
        }
开发者ID:nudaca,项目名称:simplehttpserver.uwp,代码行数:28,代码来源:BackgroundTask.cs



注:本文中的ValueSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ValueSource类代码示例发布时间:2022-05-24
下一篇:
C# ValueRef类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap