小编Kin*_*sar的帖子

如何在Windows Phone 8中选择ListBox项目时更改Ellipse的笔划?

我目前正在使用Windows Phone 8,我在其中创建了一个带有Ellipse的ListBox来显示图像.现在我想在用户选择ListBox中的任何项目时更改它的笔触颜色.我的ListBox XAML代码及其DataTemplate如下所示

<ListBox x:Name="OwnerList"
         ScrollViewer.HorizontalScrollBarVisibility="Auto"
         ScrollViewer.VerticalScrollBarVisibility="Disabled"
         ItemsPanel="{StaticResource FileItemsPanel}"
         ItemTemplate="{StaticResource OwnerListTemplate}"
         SelectionMode="Multiple"
         SelectionChanged="OwnerList_SelectionChanged"/>
Run Code Online (Sandbox Code Playgroud)

DataTemplate中

<DataTemplate x:Key="OwnerListTemplate">
        <StackPanel Margin="20,0,20,0">
            <Ellipse Height="120"
                     Width="120"
                     Margin="4"
                     Stroke="Blue"
                     StrokeThickness="2">
                <Ellipse.Fill>
                    <ImageBrush ImageSource="{Binding PHOTO, Converter={StaticResource Imageconverter}}"/>
                </Ellipse.Fill>
            </Ellipse>
            <TextBlock x:Name="OwnerName"
                       Text="{Binding NAME}"
                       FontSize="22"
                       Foreground="Gray"
                       FontWeight="Bold"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"/>
            <TextBlock x:Name="distance"
                       Text="{Binding DISTANCE}"
                       FontSize="20"
                       Foreground="Gray"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"/>
        </StackPanel>
    </DataTemplate>


    <ItemsPanelTemplate x:Key="FileItemsPanel">
        <StackPanel Orientation="Horizontal">
            <StackPanel.RenderTransform>
                <TranslateTransform X="0" />
            </StackPanel.RenderTransform>
        </StackPanel>
    </ItemsPanelTemplate>
Run Code Online (Sandbox Code Playgroud)

我知道如何更改整个列表项的前景,但我不知道如何更改椭圆笔划颜色.为了更改ListBox的前景颜色,我实现了下面的代码

<Style x:Key="DynamicDataGenericListViewContainerStyle"
       TargetType="ListBoxItem">
        <Setter Property="HorizontalContentAlignment"
            Value="Stretch" />
        <Setter Property="Margin"
            Value="0,0,0,1"/>
        <Setter Property="Padding"
            Value="0"/>

        <Setter Property="Template">
            <Setter.Value> …
Run Code Online (Sandbox Code Playgroud)

c# windows-phone-8

13
推荐指数
1
解决办法
330
查看次数

如何在Windows 10 UWP中基于HTML内容调整Webview高度?

我目前正在使用Windows 10 UWP App并面临WebView的问题,当我的HTML内容较少时,我在javascript中获得更高的高度.我的守则如下

WebView webView = new WebView() { IsHitTestVisible = true };
                string notifyJS = @"<script type='text/javascript' language='javascript'>

                                            function setupBrowser(){
                                            document.touchmove=function(){return false;};;
                                            document.onmousemove=function(){return false;};
                                            document.onselectstart=function(){return false;};
                                            document.ondragstart=function(){return false;}
                                            window.external.notify('ContentHeight:'+document.body.firstChild.offsetHeight);
                                            //window.external.notify('ContentHeight:'+document.getElementById('pageWrapper').offsetHeight);
                                            var links = document.getElementsByTagName('a');
                                            for(var i=0;i<links.length;i++) {
                                               links[i].onclick = function() {
                                                    window.external.notify(this.href);
                                                        return false;
                                            }
                                            }
                                        }
                                    </script>";


                string htmlContent;
                if (hexcolor != null)
                {
                    htmlContent = string.Format("<html><head>{0}</head>" +
                                                    "<body onLoad=\"setupBrowser()\" style=\"margin:0px;padding:0px;background-color:{2};\">" +
                                                    "<div id=\"pageWrapper\" style=\"width:100%;word-wrap:break-word;padding:0px 25px 0px 25px\">{1}</div></body></html>",
                                                    notifyJS,
                                                    formItem.I_DEFAULT_VALUE,
                                                    hexcolor);
                }
Run Code Online (Sandbox Code Playgroud)

这里的formItem.I_DEFAULT_VALUE是 HTML without html,head and …

javascript c# webview uwp windows-10-universal

13
推荐指数
1
解决办法
1390
查看次数

如何在Windows Phone 8中设置RestClient的超时?

我使用RestSharp API调用Web服务.但是我遇到的问题是,当服务器花费的时间超过RestClient的默认超时(即100秒)时,我总是得到StatusCode = NotFound.我也尝试对两个Timeout进行硬编码和ReadWriteTimeout参数值,但它没有帮助.有人可以建议这里可以做些什么吗?

我的代码如下

public async Task<WebDownloadResult> SyncMobileData(string encryptedstring)
    {
        WebDownloadResult response = new WebDownloadResult();
        var client = new RestClient(BaseUrl + Constants.WEB_SERVICE_NAME);
        client.Timeout = CONN_TIMEOUT;
        client.ReadWriteTimeout = CONN_TIMEOUT;
        var request = new RestRequest(Method.POST);

        byte[] encryptedbytes=System.Text.Encoding.UTF8.GetBytes(encryptedstring);
        request.AddParameter("", encryptedbytes, ParameterType.RequestBody);

        try
        {
            response = await client.GetResponseBytesAsync(request);
        }
        catch (Exception outer)
        {
            response.ErrorOccured = true;
            response.ErrorMessage = outer.Message;
        }
        return response;

    }
Run Code Online (Sandbox Code Playgroud)

其中CONN_TIMEOUT = 600000,我的响应处理类如下:

public static class RestClientExtensions
{
    private static Task<T> GetResponseFromServer<T>(this RestClient client, IRestRequest request, …
Run Code Online (Sandbox Code Playgroud)

c# restsharp windows-phone-8

6
推荐指数
1
解决办法
1027
查看次数

如何在 Visual Studio 2017 中安装 Windows Phone 8 工作负载?

我已经在我的计算机中安装了 Visual Studio 2017,安装后当我尝试打开我的 Windows Phone 8 项目时,我收到一个错误,提示缺少 Windows Phone 8 SDK。因此,我右键单击该项目并单击安装缺少的功能,但每次都显示 0 Kb。那么,有人可以建议我在 Visual Studio 2017 中安装 Windows Phone 8 SDK 和工具/模板的步骤吗?我也尝试安装 Standalone SDK,但它仍然给我一些 JSON Package 错误,并且在 Visual Studio 中它显示了我的项目 name.csproj error: Operation Canceled

请提出一些解决方案,以便我可以在 VS2017 中处理我的 Windows Phone 8 项目。

visual-studio windows-phone windows-phone-8

5
推荐指数
1
解决办法
1936
查看次数

Windows 10中的Html编辑类似于Mail应用程序?

我想通过向他提供所有格式化选项(如粗体,斜体,下划线,子弹点等)来阅读HTML并允许我的用户进行编辑HTML.我还注意到,当我们点击底部栏中的更多内容时,Microsoft会在其默认的Outlook Mail应用程序中允许所有此类格式化选项.有人可以建议是否有任何直接API在Windows 10或任何第三方API中实现这一点Nuget

我想实现如下:

在此输入图像描述

c# win-universal-app windows-10-universal

4
推荐指数
1
解决办法
712
查看次数

如何检查Windows 10移动模拟器的独立存储?

我目前正在使用Windows 10,我的要求是检查Windows 10 Mobile模拟器的独立存储.使用Windows Phone 8/8.1,可以使用我们可以使用命令提示符使用的IsolatedExplorerTool.任何人都可以建议,我如何为Windows 10模拟器实现相同的目标?

c# windows-10 windows-10-mobile

3
推荐指数
1
解决办法
2961
查看次数

如何在 WebView Windows 10 UWP 中调用 javascript?

我正在尝试在 WebView 中加载一个 javascript 来进行一些计算并以字符串形式获取输出。我尝试使用以下代码

string htmlFragment = "<html><head><script type='text/javascript'>" +
                    "function doubleIt(incoming){ " +
                    "  var intIncoming = parseInt(incoming, 10);" +
                    "  var doubled = intIncoming * 2;" +
                    "  document.body.style.fontSize= doubled.toString() + 'px';" +
                    "  return doubled.toString());" +
                    "};" +
                    "</script></head><body>" +
                    "<div id = 'myDiv'>I AM CONTENT</div></body></html>";
            htmlView.NavigateToString(htmlFragment);
            htmlView.LoadCompleted += async(s1,e1) =>
              {
                  string result = await htmlView.InvokeScriptAsync("eval", new string[] { "doubleIt(25)" });
                  Debug.WriteLine(result);
              };
Run Code Online (Sandbox Code Playgroud)

更新 我现在可以根据答案中提供的帮助轻松加载简单的 javascript。但是现在当 javascript 中有多个函数时,我遇到了问题,我得到了一个例外。我正在尝试以下代码

string htmlFragment = @"<html><head><script type='text/javascript'>" +
                    "function …
Run Code Online (Sandbox Code Playgroud)

javascript c# webview uwp windows-10-universal

3
推荐指数
1
解决办法
7055
查看次数

如何从oracle的Base64字符串中删除'\r\n'?

我在 Oracle 中创建了以下函数来将我的字符串转换为 BASE64,并且在 64 个字符后得到一个新行。功能如下

function to_base64(t in varchar2) return varchar2 is
begin
  return utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw(t)));
end to_base64; 
Run Code Online (Sandbox Code Playgroud)

我的输入是 tobase64('ACae23b41949dbcfa8cd2c8b114bb81af4:909f2edb3e9b8c7e9c545d2942aa8576')

我得到的输出如下,在 64 个字符后添加新行。 QUNhZTIzYjQxOTQ5ZGJjZmE4Y2QyYzhiMTE0YmI4MWFmNDo5MDlmMmVkYjNlOWI4 YzdlOWM1NDVkMjk0MmFhODU3Ng==

有人可以建议我如何删除新行或函数中所需的任何更改吗?

database oracle base64 plsql

3
推荐指数
1
解决办法
1693
查看次数

如何将空字符串放入 JSON_OBJECT_T 对象中?

我正在尝试JSON_OBJECT_T使用以下代码向 a 添加一个空字符串,但我得到的null是值而不是空字符串。

DECLARE
   V_OBJ JSON_OBJECT_T;
BEGIN
   V_OBJ := JSON_OBJECT_T();
   V_OBJ.PUT('customerAccRef','');
   DBMS_OUTPUT.PUT_LINE(V_OBJ.stringify);
END;
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我得到以下 json

{"customerAccRef":null}
Run Code Online (Sandbox Code Playgroud)

我想要如下输出

{"customerAccRef":""}
Run Code Online (Sandbox Code Playgroud)

有人可以建议我需要做什么更改才能传递空字符串吗?

oracle json plsql oracle12c oracle18c

3
推荐指数
1
解决办法
4683
查看次数

如何在ListView项目的Windows 10 UWP中添加上下文菜单?

我正在使用Windows 10 UWP应用程序,并在照片应用程序中遇到了长按菜单,如下所示

上下文菜单

有人可以建议如何在Windows 10中创建此类菜单吗?

我检查了PopupMenu控件,但它只允许菜单中的6个选项.我想使用C#而非XAML创建此菜单.

c# uwp windows-10-universal

2
推荐指数
1
解决办法
5347
查看次数

Oracle 12.1.0.2中的批量更新?

我目前正在处理一项任务,并要求通过读取JSON中的值来更新大约2000到4000条记录.我优化了JSON部分但是目前,我正在逐个更新每个记录.有人建议使用单一查询更新所有2000到4000条记录的最佳方法,而不是运行2000至4000次吗?这是我的示例代码

    APEX_JSON.PARSE(V_OUTPUT_DATA); 
plan_count := apex_json.get_count('plan'); 
IF plan_count > 0 THEN 
    FOR I in 1..plan_count LOOP 
        activities_count := APEX_JSON.get_count(p_path => 'plan['||i||'].activities'); 
        IF activities_count > 0 THEN 
            FOR j in 2..(activities_count-1) LOOP 
                V_TASK_ID := APEX_JSON.get_varchar2(p_path => 'plan['||i||'].activities['||j||'].task_id'); 
                V_SEQ := APEX_JSON.get_number(p_path => 'plan['||i||'].activities['||j||'].sequence');
                UPDATE TABLE_NAME 
                SET ROUTE_SEQUENCE = V_SEQ, UPDATED_BY = 'SYSTEM',UPDATED_ON = SYSTIMESTAMP 
                WHERE TASK_ID = V_TASK_ID; 
            END LOOP; 
            COMMIT; 
        END IF; 
    END LOOP;       
END IF;
Run Code Online (Sandbox Code Playgroud)

我应该使用2D阵列并使用它进行批量更新还是可以遵循其他方法?

已添加示例JSON

{
"plan": [{
    "vehicle_id": "vehicle_1",
    "activities": [{
        "sequence": 0,
        "timestamp": "2017-11-10T09:48:19Z",
        "location_id": "depot"
    }, …
Run Code Online (Sandbox Code Playgroud)

oracle plsql oracle12c bulkupdate

2
推荐指数
1
解决办法
85
查看次数

如何在 Windows 通用应用程序中运行时访问和更改资源字典中资源的值?

我正在将 Windows Phone 8 应用程序迁移到 Windows 通用应用程序。我创建了一个资源字典,其中包含 Windows 8.1 项目中的一些值,并将其路径包含在App.xaml文件中。下面是资源字典和App.xaml。

资源词典

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp.Styles">

<SolidColorBrush Color="#388941"
                 x:Key="AppBackGroundColor" />
<SolidColorBrush Color="White"
                 x:Key="PageTitleColor" />
<SolidColorBrush Color="White"
                 x:Key="AppFontColor" />
<SolidColorBrush Color="White"
                 x:Key="StatusColor" />
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)

应用程序.xaml

<Application
x:Class="MyCouncilServices.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp">

<Application.Resources>
    <!-- Application-specific resources -->
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>

            <!-- 
                Styles that define common aspects of the platform look and feel
                Required by Visual Studio project and item templates
             -->
            <ResourceDictionary Source="/Styles/Styles.xaml"/>

        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

现在,我想知道如何在整个应用程序中访问此值并在 C# 代码中更改其值。

我尝试了与 Windows Phone 8 …

c# win-universal-app

1
推荐指数
1
解决办法
3737
查看次数