我试图在时间选择器中减去时间值的秒.我发现代码在picker值中添加了第二个,但我无法弄清楚如何减去.
我应该怎么做呢?
private static void CreateAlarm(DateTime time, string title)
{
var alarm = new Alarm(title)
{
Content = "You have a meeting with your team now.",
BeginTime = time.AddSeconds(10),
};
}
private void SetAlarm_Click(object sender, RoutedEventArgs e)
{
CreateAlarm(Convert.ToDateTime(timePicker1.ValueString), textBox1.Text);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个可滚动的文本块.但它似乎没有用.我应该怎么做呢?以下是我的代码:
<Grid x:Name="ContentGrid" Grid.Row="1">
<ScrollViewer>
<TextBlock Height="517" HorizontalAlignment="Left" Margin="33,16,0,0" Name="textBlockRules" Text="" VerticalAlignment="Top" Width="414" FontSize="25" TextWrapping="Wrap" /></ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
我试图Substring
在图像文件名上执行一个功能.名称格式位于" images.png "中.
我尝试使用Substring
它只允许我指示第一个字符,直到"n"字符执行该功能.
这样SubString(1,6)
.
但我想要的是在之前获得任何角色.
.
例如" images.png ":
Substring
功能之后,我应该得到" 图像 ".
我正在尝试从手机歌曲集中播放音乐.
声音效果属性是否支持从歌曲集中播放?
以前我使用媒体播放器播放歌曲,但我想将音乐设置为不可暂停.
声音效果代码:SoundEffect效果; SoundEffectInstance实例;
effect = SoundEffect.FromStream(ml.Songs[songSelectedIndex]);
instance = effect.CreateInstance();
instance.IsLooped = true;
instance.Volume = 1.0f;
instance.Pitch = 1.0f;
instance.Play();
Run Code Online (Sandbox Code Playgroud)
媒体库代码:
using (var ml = new MediaLibrary())
{
FrameworkDispatcher.Update();
MediaPlayer.Play(ml.Songs[songSelectedIndex]);
MediaPlayer.IsRepeating = true;
}
Run Code Online (Sandbox Code Playgroud) 我有一个表单,它将收集用户的输入,它包含一个按钮.用户单击该按钮后,将显示弹出消息.
我想将表单输入发布到javascript中声明的url.
<div class="live-preview">
<a class="confirm" id="alert">
<input type="submit" name="submit" class="btn btn-common uppercase" value="Edit Booking">
</a>
<script>
$(".confirm").easyedit();
$("#alert").click(function() {
window.location = "processEditBookSeat.php";
});
</script>
<input name="workshopSeatLeft" type="hidden" id="workshopSeatLeft" value="<?php echo $resultWorkshopDetail['workshopDetailSeatLeft']?>">
<input name="alreadyBookedSeat" type="hidden" id="alreadyBookedSeat" value="<?php echo $userBookedSeat?>">
<input name="workshopID" type="hidden" id="workshopID" value="<?php echo $getWorkshopID?>">
</div>
Run Code Online (Sandbox Code Playgroud) 我有一个vb web形式的datalist.
如何获取数据列表的特定行和单元格中的值?
我可以为detailview做这个,但是如何为datalist做呢?
以下是我的详细信息代码:
Dim selectedCommentAns As String = DetailsView.Rows(0).Cells(1).Text
Run Code Online (Sandbox Code Playgroud)
我为datalist尝试了相同的方法,但它没有选择行和单元格.
这是我的datalist的asp标记:
<asp:DataList ID="DataListPhotoGallery" runat="server" CellPadding="5"
CellSpacing="12" DataKeyField="PhotographerPhotoId"
DataSourceID="SqlDataSourcePhotoGallery" RepeatColumns="3">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" BorderColor="#C7B273"
BorderStyle="Groove" BorderWidth="12px" Height="200px"
ImageUrl='<%# Eval("PhotographerPhotoImgPath", "images/UserUploadedPhoto/{0}") %>'
Width="220px" />
<br />
Photo No:
<asp:Label ID="PhotographerPhotoIdLabel" runat="server"
Text='<%# Eval("PhotographerPhotoId") %>' />
<br />
Photo Description:
<asp:Label ID="PhotographerPhotoDescLabel" runat="server"
Text='<%# Eval("PhotographerPhotoDesc") %>' />
<br />
Photo Name:
<asp:Label ID="PhotographerPhotoImgNameLabel" runat="server"
Text='<%# Eval("PhotographerPhotoImgName") %>' />
<br />
Photographer Name:
<asp:Label ID="PhotographerIdLabel" runat="server"
Text='<%# Eval("PhotographerName") %>' />
<br …
Run Code Online (Sandbox Code Playgroud) 我正在使用Windows Phone 7中的媒体播放器播放手机歌曲集中的音乐.但是当它播放音乐时,它们将是一个例外而且错误正在陈述
尚未调用FrameworkDispatcher.Update.定期的FrameworkDispatcher.Update调用是必要的,以便消除和忘记声音效果和框架事件以正常运行.
我该如何修改我的代码?
private void songBtn_Click(object sender, RoutedEventArgs e)
{
using (var ml = new MediaLibrary())
{
foreach (var song in ml.Songs)
{
System.Diagnostics.Debug.WriteLine(song.Artist + " " + song.Name);
MessageBox.Show(song.Artist + " " + song.Name);
}
MediaPlayer.Play(ml.Songs[0]);
}
}
Run Code Online (Sandbox Code Playgroud) 我正试图对我的arraylist进行排序.
数组列表由时间格式的数据组成.
阵:
9:15 AM, 10:20 AM
Run Code Online (Sandbox Code Playgroud)
我该如何排序?
我从下面的代码得到的结果是:
10:20 AM
9:15 AM
Run Code Online (Sandbox Code Playgroud)
以下是我的代码:
String timeText = readFileTime.ReadLine();
timeSplit = timeText.Split(new char[] { '^' });
Array.Sort(timeSplit);
foreach (var sortedArray in timeSplit)
{
sortedTimeListBox.Items.Add(sortedArray);
}
Run Code Online (Sandbox Code Playgroud) 我试图将我的代码编辑为以下但似乎不是正确的方法:
public int Compare(object x, object y)
{
string s1 = (string)x;
string s2 = (string)y;
return DateTime.Compare(DateTime.ParseExact(s1.Substring(1), "MMddyyyy", CultureInfo.InvariantCulture),
DateTime.ParseExact(s2.Substring(1), "MMddyyyy", CultureInfo.InvariantCulture));
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
IsolatedStorageFile myStore = IsolatedStorageFile.GetUserStoreForApplication();
if (scheduleListBox.Items.Count == 0)
{
try
{
//Get all the directories name that start with "a"
fileNames = myStore.GetDirectoryNames("a*");
//Sort according to the schedule month
//Array.Sort(fileNames);
Array.Sort(new Compare(fileNames));
Run Code Online (Sandbox Code Playgroud)
我在数组列表中有a08102011格式的数据.
其中08是月, 10是日, 2011是年.
怎么能按照那种方式排序?
a08102011 …
我正在尝试获取列表框中所选项目的文本.但我应该是"System.Windows.Controls.ListBoxItem"的结果
我的代码:listBox.SelectedItem.ToString();
我应该如何更改我的代码?