Skip to content

Commit

Permalink
First checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinWingChungHui committed Oct 21, 2020
1 parent ad8db93 commit 4569eab
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 0 deletions.
25 changes: 25 additions & 0 deletions MouseMover.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseMover", "MouseMover\MouseMover.csproj", "{4056DB55-B6DF-4522-80D5-C6C1EE295B1D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4056DB55-B6DF-4522-80D5-C6C1EE295B1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4056DB55-B6DF-4522-80D5-C6C1EE295B1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4056DB55-B6DF-4522-80D5-C6C1EE295B1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4056DB55-B6DF-4522-80D5-C6C1EE295B1D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E81ADD15-B6AE-49D2-B0A1-CA3C6AE82626}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions MouseMover/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="NoSleepMouse.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:NoSleepMouse"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions MouseMover/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace NoSleepMouse
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions MouseMover/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
12 changes: 12 additions & 0 deletions MouseMover/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window x:Class="MouseMover.MainWindow"
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:NoSleepMouse"
mc:Ignorable="d"
Title="Mouse Mover" SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip" FontSize="8" WindowStyle="ToolWindow">
<Grid>
<CheckBox Content="Enable Mouse Mover" Margin="10,10,10,10" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Grid.ColumnSpan="2" FontSize="12"/>
</Grid>
</Window>
41 changes: 41 additions & 0 deletions MouseMover/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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.Navigation;
using System.Windows.Shapes;

namespace MouseMover
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private Mover _mouseMOver;

public MainWindow()
{
InitializeComponent();
_mouseMOver = new Mover();
}

private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
_mouseMOver.Enable();
}

private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
_mouseMOver.Disable();
}
}
}
24 changes: 24 additions & 0 deletions MouseMover/MouseMover.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>mouse.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<None Remove="mouse.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="InputSimulatorCore" Version="1.0.5" />
</ItemGroup>

<ItemGroup>
<Resource Include="mouse.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions MouseMover/Mover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using WindowsInput;

namespace MouseMover
{
public class Mover
{

private Timer _timer;

public Mover()
{
_timer = new Timer();
_timer.Interval = 3000;
_timer.Elapsed += _timer_Elapsed;
}

public void Enable()
{
_timer.Start();
}

public void Disable()
{
_timer.Stop();
}

private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
var inSim = new InputSimulator();
inSim.Mouse.MoveMouseBy(0, 0);
}
}
}
Binary file added MouseMover/mouse.ico
Binary file not shown.
Binary file added MouseMover/mouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4569eab

Please sign in to comment.