小编Abs*_*ith的帖子

在 React Navigation 中禁用自定义标题的动画

我想禁用堆栈导航器标题部分的屏幕动画。

我通过在堆栈导航器中定义了一个通用的自定义标头screenOptions

并具有屏幕转换的默认动画。我想确保动画仅发生在屏幕上,而不发生在我的标题组件上。由于标题将是静态内容。

我也尝试过制作headerModeasscreenfloat但那没有帮助。我想看看是否有一个类似于animationEnabled标题组件的属性。

<Stack.Navigator
  screenOptions= {{
    headerMode: 'screen',
    animation: 'fade',
    header: (props) =>
        <Header {...props} />
  }}>
  // Rest of my screens
</Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation react-navigation-v5

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

BackgroundDownloader不适用于Windows 10移动UWP?

我正在创建一个Windows 10 UWP应用程序,其中涉及BackgroundDownloader,这只适用于桌面而不是手机.

码:

    var dl = new BackgroundDownloader();
    dl.CostPolicy = BackgroundTransferCostPolicy.Always;
    file = await localSoundsFolder.CreateFileAsync(name, CreationCollisionOption.ReplaceExisting);
    if (file != null)
    {
        var d = dl.CreateDownload(new Uri(uriToDownloadFrom,UriKind.RelativeOrAbsolute), file);
        d.Priority = BackgroundTransferPriority.High;

        var progressCallback = new Progress<DownloadOperation>(x => DownloadProgress(x, sc)); 
        try
        {
            await d.StartAsync().AsTask(cancellationToken.Token,progressCallback);
            //After this line it doesn't progress!
            CancellationTokenSource token = Utility.cancellationList[sc];
            if (token != null)
            {
                token.Cancel();
                Utility.cancellationList.Remove(sc);
                Debug.WriteLine("The sc has been removed from the download list");
            }
        }
        catch
        {
            return;
        }
    }


private static void DownloadProgress(DownloadOperation …
Run Code Online (Sandbox Code Playgroud)

c# windows-runtime windows-10-mobile uwp

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

如何在UWP应用中仅启用横向模式?

我已经在清单中指定了Landscape和LandscapeFlipped,我知道这只是一个首选项,在此之上,我在App.xaml.cs OnLaunched中添加了以下代码。但是,当在平板电脑上进行测试时,该应用将返回纵向模式。

 DisplayInformation.AutoRotationPreferences = 
                     DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped;
Run Code Online (Sandbox Code Playgroud)

还有没有其他替代方法可以在模拟器中而不是实际的平板电脑/设备上进行测试?

提前致谢。

c# uwp

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

如何将ListView.ItemTapped事件绑定到Xamarin Forms中的ViewModel命令?

我正在使用Prism实现MVVM。

而且我有一个情况,我有一个ListView,必须处理ItemTapped事件,还必须获取被点击的项目。

我尝试使用EventToCommandBehavior

但是我无法使它起作用,因为它无法识别添加的引用。

prism mvvm xamarin xamarin.forms

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

对已排序的数组进行排序,除了一个无序的元素

我在准备比赛的时候遇到了这个问题,我无法理解。考虑数组中的一组“n”元素,除了一个出现乱序的元素之外,该数组已排序。以下哪个排序序列需要 O(n) 时间?

  • 快速排序
  • 堆排序
  • 归并排序
  • 冒泡排序

现在我已经知道最好的方法是使用插入排序,在这种情况下这将花费 O(n) 时间,但由于它另有说明,我不确定该使用哪个。

  • 快速排序会很糟糕,因为数组已经排序了。
  • 堆排序不会完全利用数组已排序的特性,并且会花费 O(nlogn) 时间。
  • 合并排序也需要 O(nlogn),因为它不区分输入顺序。
  • 冒泡排序也需要 O(n^2)。我真的很想在这里得到一些帮助,我错过了什么吗?

arrays sorting algorithm

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

获取StorageFolder中的文件数量

我正在使用Windows Phone 8.1(RT)应用程序,我想知道如何获取StorageFolder中的文件数量.

我知道我们可以使用StorageFolder.GetFilesAsync()然后检查返回的这个列表的计数.但是,由于这个方法花费的时间太长并且返回所有项目,是否有更有效的方法来完成这项工作?

c# windows-runtime windows-phone-8.1

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

如何在Mobx-State-Tree中具有可为空的字符串值

我正在尝试使用可选的可为空的字符串值创建模型。我试过同时使用

  hint: types.optional(types.string, ""),
Run Code Online (Sandbox Code Playgroud)

  hint: types.maybe(types.string),
Run Code Online (Sandbox Code Playgroud)

当我尝试针对该对象设置json对象时,两者均会导致错误。如果我手动循环遍历json对象并将空内容设置为空字符串“”,则可以使用。

无法将路径“内容”值中的“ jsoncontent”转换null为类型时出错:(string值不是字符串)。

javascript reactjs mobx mobx-state-tree

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

如何在CSS中实现响应式功能区形状?

在此处输入图片说明

试图用CSS实现这一点。我已经做到了这一点,但是如果我的标签(CAREER)的长度超过的大小,则此操作会中断div。如果更长,则内容将自动换行,并且高度会div增加。但是左侧的色带切割并不能快速响应。有人可以建议更好的方法吗?

.custom-tag-container {
  border: 1px solid;
  margin: auto;
  display: flex;
  align-items: stretch;
  border-color: green green green transparent;
  padding: 4px !important;
}

.custom-tag-container>p {
  color: green;
  font-weight: bold;
  flex: 1;
  margin: auto;
}

#triangle-left {
  height: 25px;
  width: 25px;
  background: transparent;
  transform: rotateZ(45deg) translateX(-12.5px) translateY(12.5px);
  border: 1px solid;
  border-color: green green transparent transparent;
}
Run Code Online (Sandbox Code Playgroud)
<div class="custom-tag-container">
  <div id="triangle-left" />
  <p>Hello Worldsm</p>
</div>
Run Code Online (Sandbox Code Playgroud)

JS小提琴

html css css-shapes

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

如何在 Windows 10 uwp 中有效地使用 WriteableBitmap.setpixel()?

我有一个场景

  • 选择一个图像文件,然后使用 BitmapDecoder 将源转换为 WriteableBitmap 并将 image.source 设置为 WriteableBitmap。
  • 现在,当用户点击图像时,我会得到坐标,然后想用特定颜色为该像素周围的整个区域着色。(就像油漆中的填充选项)。

我使用的代码是

 private void setPixelColors(int xCord, int yCord, int newColor)
 {
    Color color = bit.GetPixel(xCord, yCord);
    if (color.R <= 5 && color.G <= 5 && color.B <= 5 || newColor == ConvertColorToInt(color))
    {
        //Debug.WriteLine("The color was black or same returning");
        return;
    }
    setPixelColors(xCord + 1, yCord, newColor);
    setPixelColors(xCord, yCord + 1, newColor);
    setPixelColors(xCord - 1, yCord, newColor);
    setPixelColors(xCord, yCord - 1, newColor);
    //Debug.WriteLine("Setting the color here");
    bit.SetPixel(xCord, yCord, newColor);
 }
Run Code Online (Sandbox Code Playgroud)

这有效,但效率极低。我想知道有没有更好的方法来做到这一点。 …

c# winrt-xaml writablebitmap windows-10 uwp

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

如何在uwp中鼠标悬停时增加gridviewitem的大小?

通常在鼠标悬停时,我们会得到一个灰色边框,突出显示鼠标悬停时的 gridviewitem。但不是这样,我会稍微想增加 gridviewitem 的大小,就像一点点弹出一样,当鼠标离开时,将其恢复到正常大小。请注意,大小/弹出窗口的增加不应干扰其余的 gridviewitems。

我的代码目前非常基本:

<GridView x:Name="contentGV" Margin="18,10,18,18"  
                          Width="Auto">
    <GridView.ItemContainerStyle>
        <Style TargetType="GridViewItem">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>
    </GridView.ItemContainerStyle>
    <GridView.ItemTemplate>
        <DataTemplate>
            <Grid>
                <StackPanel Margin="5,5,25,5" MaxWidth="145" Height="220">
                    <Grid Background="{Binding LogoBG}" CornerRadius="25" Height="120" Width="120">
                        <Border Height="120" Width="120" CornerRadius="25">
                            <Border.Background>
                                <ImageBrush ImageSource="{Binding LogoUrl}" />
                            </Border.Background>
                        </Border>
                    </Grid>
                    <TextBlock x:Name="Title" 
                                   MaxLines="2" Width="120"
                                   Text="{Binding Title}" TextWrapping="WrapWholeWords"/>

                </StackPanel>
            </Grid>
        </DataTemplate>
    </GridView.ItemTemplate>
</GridView>
Run Code Online (Sandbox Code Playgroud)

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

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

如何在没有XAML Winrt空间的TextBlock中使用Run?

<TextBlock>
    <Run  Text="{Binding Percentage}"/>
    <Run Text="%"/>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)

我知道这似乎是一个微不足道的问题,但我想在上面的代码中,如果百分比值为95,那么它显示95%而不是95%.那就是Run之间有一个我不想要的空间.如何删除它.

提前致谢.

xaml windows-runtime win-universal-app

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

如何在不使用C中的内置函数和循环的情况下打印字符串的反转?

我在编程比赛中遇到过这个问题,但找不到答案,任何人都可以帮我这个???

Input<<string
Output<<reverse(string)
Run Code Online (Sandbox Code Playgroud)

约束:不允许循环,不必使用内置函数!

c io reverse input output

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

在Windows Phone 8.1中实时跟踪位置

对不起,如果这是一个愚蠢的问题,我是Windows Phone 8.1开发的初学者.我正在使用MapControl在地图上显示我当前的位置,但是当我移动时,我的位置不会实时自动更新,除非我点击一个按钮并重新初始化之前创建的图钉的位置.有没有更好的方法可以在没有用户每次想要看到他当前位置时按下按钮的情况下发生这种情况.

private async Task setMyLocation() 
        {
            try
            {
                var gl = new Geolocator() { DesiredAccuracy = PositionAccuracy.High };
                Geoposition location = await gl.GetGeopositionAsync(TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(5));
                var pin = new MapIcon()
                {
                    Location = location.Coordinate.Point,
                    Title = "You are here",
                    NormalizedAnchorPoint = new Point() { X = 0, Y = 0 },
                };
                myMapView.MapElements.Add(pin);
                await myMapView.TrySetViewAsync(location.Coordinate.Point, 20);
            }
            catch
            {
                myMapView.Center = new Geopoint(App.centerPin);
                myMapView.ZoomLevel = 20;
                Debug.WriteLine("GPS NOT FOUND");
            }
            App.centerPin = myMapView.Center.Position;
        }
Run Code Online (Sandbox Code Playgroud)

提前致谢!

c# maps geolocation windows-phone-8.1

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