Skip to content

Commit a9e4f8e

Browse files
committed
Fix remaining VS messages in Signal-Windows
1 parent a5b798d commit a9e4f8e

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

Signal-Windows/Controls/ConversationListElement.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ public void UpdateConversationDisplay()
153153
{
154154
if (Model != null)
155155
{
156-
if (Model is SignalContact)
156+
if (Model is SignalContact contact)
157157
{
158-
var contact = (SignalContact)Model;
159158
BlockedIconVisible = contact.Blocked;
160159
FillBrush = contact.Color != null ? Utils.GetBrushFromColor((contact.Color)) :
161160
Utils.GetBrushFromColor(Utils.CalculateDefaultColor(Model.ThreadDisplayName));

Signal-Windows/Controls/Message.xaml.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,20 @@ private void UpdateMessageTextBlock()
146146
var length = currentIndex - previousIndex;
147147
if (length > 0)
148148
{
149-
Run run = new Run();
150-
run.Text = messageText.Substring(previousIndex, currentIndex - previousIndex);
149+
Run run = new Run
150+
{
151+
Text = messageText.Substring(previousIndex, currentIndex - previousIndex)
152+
};
151153
MessageContentTextBlock.Inlines.Add(run);
152154
}
153155

154156
// Now add the hyperlink
155157
string link = match.Value;
156158
Hyperlink hyperlink = new Hyperlink();
157-
Run hyperlinkRun = new Run();
158-
hyperlinkRun.Text = link;
159+
Run hyperlinkRun = new Run
160+
{
161+
Text = link
162+
};
159163
try
160164
{
161165
hyperlink.NavigateUri = new Uri(link);
@@ -175,8 +179,10 @@ private void UpdateMessageTextBlock()
175179
var restLength = messageText.Length - currentIndex;
176180
if (restLength > 0)
177181
{
178-
Run restRun = new Run();
179-
restRun.Text = messageText.Substring(currentIndex, restLength);
182+
Run restRun = new Run
183+
{
184+
Text = messageText.Substring(currentIndex, restLength)
185+
};
180186
MessageContentTextBlock.Inlines.Add(restRun);
181187
}
182188
}

Signal-Windows/Controls/VirtualizedMessagesCollection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ public IEnumerator GetEnumerator()
196196

197197
public int IndexOf(object value)
198198
{
199-
if (value is SignalMessageContainer)
199+
if (value is SignalMessageContainer smc)
200200
{
201-
SignalMessageContainer smc = (SignalMessageContainer) value;
202201
return GetVirtualIndex(smc.Index);
203202
}
204203
else if (value is SignalUnreadMarker)

Signal-Windows/ViewModels/MainPageViewModel.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@ public void HandleBlockedContacts(List<SignalContact> blockedContacts)
327327
{
328328
// "as" is more efficient than "is" and a cast because "as" only needs to
329329
// type check once
330-
var conversationContact = conversation.Value as SignalContact;
331-
if (conversationContact != null)
330+
if (conversation.Value is SignalContact conversationContact)
332331
{
333332
if (blockedContacts.FirstOrDefault(c => c.ThreadId == conversationContact.ThreadId) != null)
334333
{

Signal-Windows/Views/AddContactPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<TextBlock Text="Number" Margin="0,16,0,0" />
3838
<TextBox x:Name="ContactNumberTextBox" Text="{x:Bind Vm.ContactNumber, Mode=TwoWay}" IsEnabled="{x:Bind Vm.UIEnabled, Mode=OneWay}" Margin="0,4,0,0" TextChanged="ContactNumberTextBox_TextChanged" InputScope="TelephoneNumber" />
3939
<Button x:Name="AddButton" Content="Add" IsEnabled="{x:Bind Vm.AddEnabled, Mode=OneWay}" HorizontalAlignment="Stretch" Margin="0,16" Click="AddButton_Click" />
40-
<AutoSuggestBox x:Name="searchBox" VerticalAlignment="Stretch" QueryIcon="Find" TextChanged="searchBox_TextChanged" IsEnabled="{x:Bind Vm.UIEnabled, Mode=OneWay}"/>
40+
<AutoSuggestBox x:Name="searchBox" VerticalAlignment="Stretch" QueryIcon="Find" TextChanged="SearchBox_TextChanged" IsEnabled="{x:Bind Vm.UIEnabled, Mode=OneWay}"/>
4141
</StackPanel>
4242
<Grid Grid.Row="1" Visibility="{x:Bind Vm.ContactsVisible, Mode=OneWay}">
4343
<toolbox:PullToRefreshListView x:Name="ContactsList" ItemClick="ContactsList_ItemClick" ItemsSource="{x:Bind Vm.Contacts, Mode=OneWay}" IsItemClickEnabled="True" HorizontalAlignment="Center" IsEnabled="{x:Bind Vm.UIEnabled, Mode=OneWay}"

Signal-Windows/Views/AddContactPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private async void ContactsList_ItemClick(object sender, ItemClickEventArgs e)
5151
Frame.Navigate(typeof(MainPage));
5252
}
5353

54-
private void searchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
54+
private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
5555
{
5656
Vm.SearchBox_TextChanged(sender, args);
5757
}

0 commit comments

Comments
 (0)