Skip to content

Commit

Permalink
Upload program example
Browse files Browse the repository at this point in the history
  • Loading branch information
SelimWaly authored Jun 24, 2024
1 parent c678fee commit dce847c
Show file tree
Hide file tree
Showing 11 changed files with 827 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Slice.Net-Example/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>

<!-- App.config : Generic App.config file
*
* Copyright (C) 2024 Selim Waly.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details. -->

<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
16 changes: 16 additions & 0 deletions src/Slice.Net-Example/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- App.xaml.cs : Generic App.xaml file
*
* Copyright (C) 2024 Selim Waly.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*-->

<Application x:Class="WpfWindowTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
25 changes: 25 additions & 0 deletions src/Slice.Net-Example/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* App.xaml.cs : Generic App.xaml file
*
* Copyright (C) 2024 Selim Waly.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace WpfWindowTest
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
159 changes: 159 additions & 0 deletions src/Slice.Net-Example/DS.Net-Example.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2BB3EE8B-20F3-46F6-81D5-E88D5AB330BC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WpfWindowTest</RootNamespace>
<AssemblyName>WpfWindowTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Slice.Net\Slice.Net.csproj">
<Project>{f952df70-eb71-47e8-b4bd-8336e7cc27ce}</Project>
<Name>Slice.Net</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="../../assets/dark-logo.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="../../assets/light-logo.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(SolutionDir)Lib\FlexServices.DisplayHelperLib.dll" "$(TargetDir)"
copy "$(SolutionDir)Lib\SliceLibrary.dll" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
137 changes: 137 additions & 0 deletions src/Slice.Net-Example/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<!-- MainWindow.xaml.cs : The Main window of the Demo App
*
* Copyright (C) 2024 Selim Waly.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
-->

<Window x:Class="WpfWindowTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Dual Screen Library - Demo" MinWidth="650" MinHeight="700" Width="650" Height="700">

<Window.Resources>

<Style TargetType="{x:Type Grid}" x:Key="windowStyle">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Color="#06b" Offset="0.0" />
<GradientStop Color="#06c" Offset="0.3" />

<GradientStop Color="#06b" Offset="0.6" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<!--<Setter Property="FontFamily" Value="Intel Neo Sans"/>-->
</Style>
<Style TargetType="{x:Type Control}" x:Key="bigText">
<Setter Property="FontSize" Value="18" />
<Setter Property="Margin" Value="20,0,0,0"/>
<Setter Property="Foreground" Value="#eee"/>
<Setter Property="FontFamily" Value="Clear Sans"/>
</Style>
<Style TargetType="{x:Type Button}" x:Key="btnStyle">
<Setter Property="Foreground" Value="#046"/>
<Setter Property="Background" Value="#eee"/>
<Setter Property="BorderBrush" Value="LightBlue"/>
<Setter Property="FontFamily" Value="Clear Sans"/>
<Setter Property="FontSize" Value="12" />
</Style>
<Style TargetType="{x:Type Control}" x:Key="generalStyle">
<Setter Property="FontFamily" Value="Clear Sans"/>
<Setter Property="Foreground" Value="#eee"/>

<!--<Setter Property="FontFamily" Value="Intel Neo Sans"/>-->
</Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource btnStyle}"></Style>
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource generalStyle}"></Style>
<Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource generalStyle}"></Style>
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource generalStyle}"></Style>

</Window.Resources>
<Grid Style="{StaticResource windowStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Style="{StaticResource bigText}">Screen Control:</Label>
<WrapPanel Grid.Row="1" Margin="20" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="5" Click="clone_Click" Padding="10" Height="40">Clone Screens</Button>
<Button Margin="5" Click="extend_Click" Padding="10" Height="40">Extend Screens</Button>
<Button Margin="5" Click="internal_Click" Padding="10" Height="40">Set Internal</Button>
<Button Margin="5" Click="external_Click" Padding="10" Height="40">Set External</Button>
<Button Margin="5" Click="numOfDisplay_Click" Padding="10" Height="40">Check Num of Displays</Button>
</WrapPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Style="{StaticResource bigText}">Control This Window:</Label>
<WrapPanel Margin="20" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Margin="5" Click="swapScreen_Click" Padding="10" Height="40">Swap Screen</Button>
<Button Margin="5" Click="sendToPrimary_Click" Padding="10" Height="40">Send To Primary</Button>
<Button Margin="5" Click="sendToSecondary_Click" Padding="10" Height="40">Send To Secondary</Button>
<Button Margin="5" Click="align_Click" Padding="10" Height="40">Align Screen</Button>
</WrapPanel>
</Grid>

<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Style="{StaticResource bigText}">Control a Different Program:</Label>
<WrapPanel Margin="20" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel Margin="5,0,5,0" Orientation="Horizontal" HorizontalAlignment="Center">
<Label>Program name to send:</Label>
<TextBox x:Name="progNameTextBox" MinWidth="100" GotFocus="removePlaceHolderForProgName" LostFocus="addPlaceHolderForProgName">(ex: chrome)</TextBox>
<RadioButton Margin="10,5,10,0" x:Name="sendProgToPrimary" IsChecked="True">Primary</RadioButton>
<RadioButton Margin="0,5,10,0" x:Name="sendProgToSecondary">Secondary</RadioButton>
<CheckBox Margin="5" x:Name="forceExtend">Force Extend</CheckBox>
</StackPanel>
<Button Margin="5" Click="sendProgWinToScreen_Click" Padding="10" Height="40">Send Program Windows to Screen</Button>
<Button Margin="5" Click="sendProgMainWinToScreen_Click" Padding="10" Height="40">Send Programs Main Window to Screen</Button>
<Button Margin="5" Click="SendFromSecondary_Click" Padding="10" Height="40">Send All Windows From Secondary to Primary Screen</Button>
</WrapPanel>
</Grid>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Style="{StaticResource bigText}">Control The Alignment of Windows:</Label>
<StackPanel Margin="20,0,20,0" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<Label>Alignment:</Label>
<CheckBox Margin="5" x:Name="center" Content="Center"/>
<CheckBox Margin="5" x:Name="left" Content="Left"/>
<CheckBox Margin="5" x:Name="right" Content="Right"/>
<CheckBox Margin="5" x:Name="top" Content="Top"/>
<CheckBox Margin="5" x:Name="bottom" Content="Bottom"/>

</StackPanel>
</Grid>
<StackPanel Grid.Row="4">
<Image HorizontalAlignment="Center" Height="100" Margin="5,5,5,0" Grid.Row="4" VerticalAlignment="Top" Source="../../assets/light-logo.png" RenderOptions.BitmapScalingMode="HighQuality"/>
<Label HorizontalAlignment="Center" Margin="0,-20,0,0" FontWeight="Bold" FontSize="16">Dual Screen .Net</Label>
</StackPanel>
<StackPanel Margin="20,0,20,0" Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Center">
<Label>Status:</Label>
<Label x:Name="status" Margin="0,0,50,0">Ready</Label>
<Label>Number of Displays:</Label>
<Label x:Name="numOfDisplaysLabel"></Label>
</StackPanel>
</Grid>
</Window>
Loading

0 comments on commit dce847c

Please sign in to comment.