如何@"Sch\u00f6nen"在C#中解码此字符串'Sch\u00f6nen'(),我尝试了HttpUtility,但它没有给我我需要的结果,即"Schönen".
是Replace在C#一样replaceAll在Java中?
我正在尝试替换括号中的任何内容,但它似乎不适用于C#.我需要输出只是"等等".
string username = "blah (blabla)";
userName = userName.Replace("\\([^\\(]*\\)", "");
Run Code Online (Sandbox Code Playgroud)
它在我在这里使用时有效.
我需要解析一个原本没有设置年份的字符串,如"13 Aug 11:30"
但是当我输出它添加年份的日期时,我尝试了设定年份,但是年份完全错误,输出为"Thu Aug 13 11:30:00 GMT 3911"
有没有办法在解析日期后设置年份?
SimpleDateFormat formatter = new SimpleDateFormat("dd MMM HH:mm");
String dateStr = "13 Aug 11:30";
Date fromDate = (Date)formatter.parse(dateStr);
fromDate.setYear(2011);
Run Code Online (Sandbox Code Playgroud) 我试图将形状的顶角倒圆,底部笔直,但我的形状有问题,它正在节省
错误!UnsupportedOperationException:null
当我有
<corners android:radius="10dp" android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp" android:topRightRadius="10dp"
android:topLeftRadius="10dp" />
Run Code Online (Sandbox Code Playgroud)
我尝试将1dp放在底角并取出android:radius ="10dp",但仍然给我一个错误.
带有Eclipse的Android 2.2
谁能帮我?
编辑:我一直得到OutOfMemoryException未处理,我认为这是我如何将图像保存到隔离存储,我认为这是我可以解决我的问题,如何在保存之前减小图像的大小?(添加了我保存图片的代码)
我从隔离存储打开图像有时超过100个图像,我想循环它们的图像,但我得到一个OutOfMemory Exception时,有大约100到150个图像加载到故事板.如何处理此异常,我已经降低了图像的分辨率.如何处理此异常并阻止我的应用程序崩溃?
我在这条线上得到了例外
image.SetSource(isStoreTwo.OpenFile(projectFolder + "\\MyImage" + i + ".jpg", FileMode.Open, FileAccess.Read));//images from isolated storage
这是我的代码
private void OnLoaded(object sender, RoutedEventArgs e)
{
IsolatedStorageFile isStoreTwo = IsolatedStorageFile.GetUserStoreForApplication();
try
{
storyboard = new Storyboard
{
//RepeatBehavior = RepeatBehavior.Forever
};
var animation = new ObjectAnimationUsingKeyFrames();
Storyboard.SetTarget(animation, projectImage);
Storyboard.SetTargetProperty(animation, new PropertyPath("Source"));
storyboard.Children.Add(animation);
for (int i = 1; i <= savedCounter; i++)
{
BitmapImage image = new BitmapImage();
image.SetSource(isStoreTwo.OpenFile(projectFolder + "\\MyImage" + i + ".jpg", FileMode.Open, FileAccess.Read));//images from isolated storage …Run Code Online (Sandbox Code Playgroud) 我在从列表框中的绑定文本块中获取字符串时遇到问题,当我使用下面的代码时,我可以绑定列表框,列表框中有项目显示,但是当列表中的项目被点击时我不会得到正确的字符串,我在消息框中打印一个带有对象名称的消息
"MyApp.Item"
而是显示出来.myApp是应用程序的名称,Item是我绑定到列表框的模型的名称.当列表框没有绑定时,所选项目中的正确文本显示出来.
private void listBoxtrend_Tap(object sender, GestureEventArgs e)
{
selectedText = "";
selectedText = listBox.SelectedValue.ToString();
MessageBox.Show(selectedText);
}
Run Code Online (Sandbox Code Playgroud)
XML
<ListBox ItemsSource="{Binding Item}" Foreground="RoyalBlue"
Height="395" HorizontalAlignment="Center"
Margin="12,111,0,0" Name="listBox"
VerticalAlignment="Top" Width="438"
TabIndex="10" Tap="listBox_Tap" >
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" FontSize="26" HorizontalAlignment="Left"
Name="tblItem" Text="{Binding ItemString}"
VerticalAlignment="Top" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
如果你能帮助我,我真的很感激
我正在使用DispatchTimer每秒做一些事情,我怎样才能让它做一段时间,比如1分钟或2分钟?我需要花药嵌套的DispatcherTimer吗?
我的代码如下
System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
private void StartButton_Click(object sender, RoutedEventArgs e)
{
TimeSpan interval;
interval = (TimeSpan)intervalPicker.Value;
dt.Interval = interval;
dt.Tick += new EventHandler(dt_Tick);
dt.Start();
}
void dt_Tick(object sender, EventArgs e)
{
//Do Something
}
Run Code Online (Sandbox Code Playgroud)
如果你能帮助我,我将不胜感激.
因此,当使用 Logrus 时,我需要日志记录输出具有 keymessage而不是msgkey,但是当我使用下面的代码时,我得到了两者,但msg为空,如何配置 logrus 以使用“message”而不是“msg”?
contextLogger.WithField("logger_name",topic).WithField("message",messageString).Info()
Run Code Online (Sandbox Code Playgroud)
.Info()这是将空的日志输出.Info()到msg键时的日志输出
"logger_name": "logger","message": "log message","msg": "","time": "2020-08-12T15:14:48Z"
Run Code Online (Sandbox Code Playgroud)
我想要的是能够使用.Info(message)并拥有
"logger_name": "logger","message": "log message","time": "2020-08-12T15:14:48Z"
Run Code Online (Sandbox Code Playgroud)
是否可以更改 .Info() 等的默认日志记录键?
我正在使用Codeplex 的Tombstone帮助器,我有点困惑,我认为它保存了应用程序控件的状态,即Textbox,我在我的应用程序的一个页面上使用代码而不在另一个页面上使用它,但是当我测试它时它只是保存两个页面中文本框的状态相同,没有Tombstone Helper的文本框在我测试它时会保持状态.我正在测试的方法是按下模拟器上的Windows徽标打开浏览器,然后按住后退按钮.
这是我用于墓碑的代码
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
{
this.SaveState(e);
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
this.RestoreState();
}
Run Code Online (Sandbox Code Playgroud)
如果你能帮助我,我将不胜感激
我需要为DateTime设置一年中的某一天,我从过去的日期开始说"5/7/2000",那天是128,我现在想要设置另一个日期时间128,所以我可以得到今年那个星期一的那一天.你能帮助我吗?
这是我正在尝试的代码,我将日期绑定在列表框中,然后点击它以获取所选日期
string selectedTap = "";
int dayOfYear;
DateTime dayOfThisYear;
var selected = listBoxItem.SelectedValue as Ages;
selectedTap = selected.DOB;
dayOfYear = (DateTime.Parse(selectedTap, CultureInfo.InvariantCulture).DayOfYear);
//dayOfThisYear.DayOfYear = dayOfYear; //Need to set this date
MessageBox.Show(selectedTap + dayOfYear);
Run Code Online (Sandbox Code Playgroud) c# ×7
java ×2
silverlight ×2
android ×1
codeplex ×1
go ×1
logrus ×1
regex ×1
soap ×1
tombstoning ×1
web-services ×1
xaml ×1