Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
388afd4fea
10 files changed
+277
-34
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.InputBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.WindowsView"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ResizeMode ="NoResize"
|
||||
Title="SUNLIGHT"
|
||||
Height="150" Width="400">
|
||||
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
|
||||
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
|
||||
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
|
||||
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
|
||||
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
/// <summary>
|
||||
/// InputBox.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class InputBox : Window
|
||||
{
|
||||
public InputBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = this;
|
||||
FocusManager.SetFocusedElement(Boxx, Boxx);
|
||||
}
|
||||
|
||||
public string InputValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return Boxx.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Boxx.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler Accept;
|
||||
|
||||
private void YES_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var input = Boxx.Text.TrimStart(); //去除字符串前空格
|
||||
if (input.Length == 0) //字长度不等于0有效
|
||||
{
|
||||
Boxx.Focus(); //聚焦元素
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Accept != null)
|
||||
{
|
||||
Accept(this, EventArgs.Empty);
|
||||
}
|
||||
this.Close(); //关闭窗口
|
||||
}
|
||||
}
|
||||
|
||||
private void NO_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close(); //关闭窗口
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user