飞扬 / 极光便签 公开
main
极光便签/MainWindow.xaml
MainWindow.xaml4.5 KB
<Window x:Class="MyCoolApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="极光便签" Height="350" Width="320"
        WindowStyle="None" AllowsTransparency="True" Background="Transparent"
        Topmost="True" ShowInTaskbar="False" 
        MouseLeftButtonDown="Window_MouseLeftButtonDown" MouseWheel="Window_MouseWheel"
        PreviewKeyDown="Window_PreviewKeyDown">

    <Border Name="mainBorder" CornerRadius="12" Background="#DD222222" BorderBrush="#FF444444" BorderThickness="3" Margin="10">
        <Border.ContextMenu>
            <ContextMenu>
                <MenuItem Header="老板键设置 (重启生效)">
                    <MenuItem Header="Ctrl+Shift+Q" Click="SetHotkey_Click" Tag="Q"/>
                    <MenuItem Header="Ctrl+Shift+Z" Click="SetHotkey_Click" Tag="Z"/>
                    <MenuItem Header="Ctrl+Shift+H" Click="SetHotkey_Click" Tag="H"/>
                </MenuItem>
                <MenuItem Header="浏览器选择">
                    <MenuItem Header="Microsoft Edge" Name="menuEdge" IsCheckable="True" Click="SetBrowser_Click"/>
                    <MenuItem Header="Google Chrome" Name="menuChrome" IsCheckable="True" Click="SetBrowser_Click"/>
                </MenuItem>
                <MenuItem Header="搜索平台">
                    <MenuItem Header="必应 (Bing)" Name="menuBing" IsCheckable="True" Click="SetSearchEngine_Click" Tag="https://www.bing.com/search?q="/>
                    <MenuItem Header="百度 (Baidu)" Name="menuBaidu" IsCheckable="True" Click="SetSearchEngine_Click" Tag="https://www.baidu.com/s?wd="/>
                    <MenuItem Header="谷歌 (Google)" Name="menuGoogle" IsCheckable="True" Click="SetSearchEngine_Click" Tag="https://www.google.com/search?q="/>
                    <MenuItem Header="搜狗 (Sogou)" Name="menuSogou" IsCheckable="True" Click="SetSearchEngine_Click" Tag="https://www.sogou.com/web?query="/>
                </MenuItem>
                <Separator/>
                <MenuItem Header="清空内容" Click="ClearAll_Click"/>
                <Separator/>
                <MenuItem Header="关于作者" Click="About_Click"/>
            </ContextMenu>
        </Border.ContextMenu>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Grid Grid.Row="0" Margin="10,0">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <Ellipse Name="statusDot" Width="8" Height="8" Fill="LimeGreen" Opacity="0.5" VerticalAlignment="Center" Margin="0,0,5,0"/>
                    <TextBox Name="txtTimerMin" Text="25" Width="25" Background="#33FFFFFF" Foreground="White" BorderThickness="0" VerticalAlignment="Center" TextAlignment="Center" FontSize="10"/>
                    <Button Content="计时/分" Click="BtnStartTimer_Click" Background="Transparent" Foreground="White" BorderThickness="0" Cursor="Hand" Padding="3,0"/>
                    <TextBlock Name="lblTimer" Text="00:00" Foreground="Orange" VerticalAlignment="Center" FontSize="11" FontWeight="Bold" Visibility="Collapsed" Margin="5,0"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button Content="搜索" Click="BtnSearch_Click" Background="Transparent" Foreground="Gray" BorderThickness="0" Cursor="Hand" ToolTip="选中文本按F1搜索"/>
                    <Button Content="皮肤" Click="BtnSkin_Click" Background="Transparent" Foreground="Gray" BorderThickness="0" Cursor="Hand" Margin="5,0"/>
                    <Button Content="置顶" Name="btnPin" Click="BtnPin_Click" Background="Transparent" Foreground="Cyan" BorderThickness="0" Cursor="Hand"/>
                    <Button Content="退出" Click="BtnClose_Click" Background="Transparent" Foreground="Red" BorderThickness="0" Cursor="Hand" Margin="5,0"/>
                </StackPanel>
            </Grid>

            <TextBox Name="txtNote" Grid.Row="1" Background="Transparent" Foreground="White" 
                     BorderThickness="0" FontSize="14" Margin="10" TextWrapping="Wrap" 
                     AcceptsReturn="True" CaretBrush="Cyan" TextChanged="txtNote_TextChanged"
                     VerticalScrollBarVisibility="Auto" AcceptsTab="True"/>
        </Grid>
    </Border>
</Window>