Skip to content

Commit

Permalink
Initial check-in of module LogViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Devengineer committed Feb 16, 2016
0 parents commit 43608f3
Show file tree
Hide file tree
Showing 8 changed files with 516 additions and 0 deletions.
17 changes: 17 additions & 0 deletions LogViewer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogViewer", "LogViewer\LogViewer.csproj", "{B5363944-DC36-44CE-A4DE-276A41792DB0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B5363944-DC36-44CE-A4DE-276A41792DB0}.Debug|x86.ActiveCfg = Debug|x86
{B5363944-DC36-44CE-A4DE-276A41792DB0}.Debug|x86.Build.0 = Debug|x86
{B5363944-DC36-44CE-A4DE-276A41792DB0}.Release|x86.ActiveCfg = Release|x86
{B5363944-DC36-44CE-A4DE-276A41792DB0}.Release|x86.Build.0 = Release|x86
EndGlobalSection
EndGlobal
67 changes: 67 additions & 0 deletions LogViewer/LogViewer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{B5363944-DC36-44CE-A4DE-276A41792DB0}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LogViewer</RootNamespace>
<AssemblyName>LogViewer</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="gdk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="glib-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="pango-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="atk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
<LogicalName>gui.stetic</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
<Compile Include="MainWindow.cs" />
<Compile Include="gtk-gui\MainWindow.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
88 changes: 88 additions & 0 deletions LogViewer/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System;
using Gtk;

public partial class MainWindow: Gtk.Window
{
public MainWindow () : base (Gtk.WindowType.Toplevel)
{
Build ();
}

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}


protected void OnOpen (object sender, EventArgs e)
{
// Reset the LogTreeView and change the window back to original size
int width, height;
this.GetDefaultSize (out width, out height);
this.Resize (width, height);

logTextView.Buffer.Text = "";

//Create and display a fileChooserDialog
FileChooserDialog chooser = new FileChooserDialog (
"Please select a logfile to view ...",
this,
FileChooserAction.Open,
"Cansel", ResponseType.Cancel,
"Open", ResponseType.Accept);

if (chooser.Run() == (int) ResponseType.Accept)
{
// Open the file for reading
System.IO.StreamReader file = System.IO.File.OpenText (chooser.Filename);

// Copy the contents into the LogTextView
logTextView.Buffer.Text = file.ReadToEnd ();

// Set the MainWindow Title to the filename
this.Title = "Log Viewer -- " + chooser.Filename.ToString ();

// Make the MainWindow bigger to accomodate the text in the LogTextView
this.Resize (640, 480);

//Close the file so as to not leave a mess
file.Close();
}
chooser.Destroy ();
}

protected void OnClose (object sender, EventArgs e)
{
// Reset the LogTreeView and change the window back to original size
int width, height;
this.GetDefaultSize (out width, out height);
this.Resize (width, height);

logTextView.Buffer.Text = "";

// Change the MainWindow Title back to the default
this.Title = "Log Viewer";
}

protected void OnExit (object sender, EventArgs e)
{
Application.Quit ();
}

protected void OnAbout (object sender, EventArgs e)
{
// Create a new About dialog
AboutDialog about = new AboutDialog ();

// Change the Dialog's properties to the appropriate values
about.ProgramName = "Log Viewer";
about.Version = "1.0.0";

// Show the Dialog and pass it control
about.Run ();

// Destroy the dialog
about.Destroy ();
}
}
16 changes: 16 additions & 0 deletions LogViewer/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Gtk;

namespace LogViewer
{
class MainClass
{
public static void Main (string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
win.Show ();
Application.Run ();
}
}
}
27 changes: 27 additions & 0 deletions LogViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("LogViewer")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("YanowskiyVD")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

114 changes: 114 additions & 0 deletions LogViewer/gtk-gui/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

// This file has been generated by the GUI designer. Do not modify.

public partial class MainWindow
{
private global::Gtk.UIManager UIManager;

private global::Gtk.Action FileAction;

private global::Gtk.Action OpenAction;

private global::Gtk.Action CloseAction;

private global::Gtk.Action ExitAction;

private global::Gtk.Action HelpAction;

private global::Gtk.Action AboutAction;

private global::Gtk.Action HelpAction1;

private global::Gtk.Action HelpAction2;

private global::Gtk.Action AboutAction1;

private global::Gtk.VBox vbox1;

private global::Gtk.MenuBar menubar1;

private global::Gtk.ScrolledWindow scrolledwindow1;

private global::Gtk.TextView logTextView;

protected virtual void Build ()
{
global::Stetic.Gui.Initialize (this);
// Widget MainWindow
this.UIManager = new global::Gtk.UIManager ();
global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default");
this.FileAction = new global::Gtk.Action ("FileAction", global::Mono.Unix.Catalog.GetString ("_File"), null, null);
this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("_File");
w1.Add (this.FileAction, "<Alt>f");
this.OpenAction = new global::Gtk.Action ("OpenAction", global::Mono.Unix.Catalog.GetString ("_Open"), null, null);
this.OpenAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Open");
w1.Add (this.OpenAction, "<Primary>o");
this.CloseAction = new global::Gtk.Action ("CloseAction", global::Mono.Unix.Catalog.GetString ("C_lose"), null, null);
this.CloseAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Close");
w1.Add (this.CloseAction, "<Primary>l");
this.ExitAction = new global::Gtk.Action ("ExitAction", global::Mono.Unix.Catalog.GetString ("E_xit"), null, null);
this.ExitAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Exit");
w1.Add (this.ExitAction, "<Primary>x");
this.HelpAction = new global::Gtk.Action ("HelpAction", global::Mono.Unix.Catalog.GetString ("Help"), null, null);
this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Help");
w1.Add (this.HelpAction, null);
this.AboutAction = new global::Gtk.Action ("AboutAction", global::Mono.Unix.Catalog.GetString ("About"), null, null);
this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("About");
w1.Add (this.AboutAction, null);
this.HelpAction1 = new global::Gtk.Action ("HelpAction1", global::Mono.Unix.Catalog.GetString ("_Help"), null, null);
this.HelpAction1.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Help");
w1.Add (this.HelpAction1, null);
this.HelpAction2 = new global::Gtk.Action ("HelpAction2", global::Mono.Unix.Catalog.GetString ("_Help"), null, null);
this.HelpAction2.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Help");
w1.Add (this.HelpAction2, "<Primary>h");
this.AboutAction1 = new global::Gtk.Action ("AboutAction1", global::Mono.Unix.Catalog.GetString ("About"), null, null);
this.AboutAction1.ShortLabel = global::Mono.Unix.Catalog.GetString ("About");
w1.Add (this.AboutAction1, null);
this.UIManager.InsertActionGroup (w1, 0);
this.AddAccelGroup (this.UIManager.AccelGroup);
this.Name = "MainWindow";
this.Title = global::Mono.Unix.Catalog.GetString ("Log Viewer");
this.Icon = global::Stetic.IconLoader.LoadIcon (this, "gtk-bold", global::Gtk.IconSize.Menu);
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
// Container child MainWindow.Gtk.Container+ContainerChild
this.vbox1 = new global::Gtk.VBox ();
this.vbox1.Name = "vbox1";
this.vbox1.Spacing = 6;
// Container child vbox1.Gtk.Box+BoxChild
this.UIManager.AddUiFromString (@"<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='OpenAction' action='OpenAction'/><menuitem name='CloseAction' action='CloseAction'/><menuitem name='ExitAction' action='ExitAction'/></menu><menu name='HelpAction2' action='HelpAction2'><menuitem name='AboutAction1' action='AboutAction1'/></menu></menubar></ui>");
this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1")));
this.menubar1.Name = "menubar1";
this.vbox1.Add (this.menubar1);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.menubar1]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow1.CanFocus = true;
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow1.Gtk.Container+ContainerChild
this.logTextView = new global::Gtk.TextView ();
this.logTextView.CanFocus = true;
this.logTextView.Name = "logTextView";
this.logTextView.Editable = false;
this.logTextView.CursorVisible = false;
this.scrolledwindow1.Add (this.logTextView);
this.vbox1.Add (this.scrolledwindow1);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.scrolledwindow1]));
w4.Position = 1;
this.Add (this.vbox1);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 400;
this.DefaultHeight = 300;
this.Show ();
this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
this.OpenAction.Activated += new global::System.EventHandler (this.OnOpen);
this.CloseAction.Activated += new global::System.EventHandler (this.OnClose);
this.ExitAction.Activated += new global::System.EventHandler (this.OnExit);
this.AboutAction1.Activated += new global::System.EventHandler (this.OnAbout);
}
}
Loading

0 comments on commit 43608f3

Please sign in to comment.