Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
882ecf3a4b | ||
|
|
9563b2220d | ||
|
|
9a3adc5059 | ||
|
|
16b15c44a6 | ||
|
|
2afc189307 |
+1
-1
@@ -1 +1 @@
|
||||
1.0.20
|
||||
1.0.21
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using Autofac;
|
||||
using Autofac.Extras.AggregateService;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
using JiraTimeBot.JiraIntegration.Comments;
|
||||
@@ -8,6 +7,8 @@ using JiraTimeBot.Mercurial.Modifiers;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.TaskTime;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBot.DI
|
||||
{
|
||||
@@ -21,8 +22,17 @@ namespace JiraTimeBot.DI
|
||||
|
||||
public IContainer Build(TextBox logTextBox)
|
||||
{
|
||||
_builder.Register(f => new Logger(logTextBox)).As<ILog>().AsSelf();
|
||||
|
||||
_builder.Register(c => logTextBox).AsSelf();
|
||||
|
||||
_builder.Register(f =>
|
||||
{
|
||||
var txt = f.Resolve<TextBox>();
|
||||
return new Logger(message =>
|
||||
{
|
||||
txt.Invoke(new Action<string>(text => txt.AppendText(text)), message + Environment.NewLine);
|
||||
});
|
||||
}).As<ILog>().AsSelf();
|
||||
|
||||
_builder.Register(f => new TrayMenu()).As<ITrayMenu>().AsSelf();
|
||||
_builder.Register(c => new CommitSkipper()).As<ICommitSkipper>();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBot.JiraIntegration.Comments
|
||||
{
|
||||
|
||||
@@ -1,29 +1,23 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
public class Logger : ILog
|
||||
{
|
||||
private readonly TextBox _txt;
|
||||
private readonly AppendLog _safeAppender;
|
||||
private readonly Action<string> _logAction;
|
||||
|
||||
public Logger(TextBox txt)
|
||||
public Logger(Action<string> logAction)
|
||||
{
|
||||
_txt = txt;
|
||||
_safeAppender = text => _txt.AppendText(text);
|
||||
|
||||
_logAction = logAction;
|
||||
}
|
||||
|
||||
private void AppendText(string message)
|
||||
{
|
||||
message = $"{DateTime.Now:HH:mm} {message}";
|
||||
_txt.Invoke(_safeAppender, message + Environment.NewLine);
|
||||
_logAction(message);
|
||||
}
|
||||
|
||||
private delegate void AppendLog(string text);
|
||||
|
||||
public void Info([Localizable(false)] string message)
|
||||
{
|
||||
AppendText(message);
|
||||
|
||||
+12
-27
@@ -1,45 +1,30 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using JiraTimeBot.UI;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using JiraTimeBot.UI;
|
||||
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
private static Mutex _mutex = new Mutex(true, "{44426B3E-B901-4792-ACEA-1385D79DBAD1}");
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
if (PriorProcess() != null)
|
||||
if (_mutex.WaitOne(TimeSpan.Zero, true))
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmMain());
|
||||
_mutex.ReleaseMutex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
MessageBox.Show("Another instance of the app is already running.");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new frmMain());
|
||||
}
|
||||
|
||||
public static Process PriorProcess()
|
||||
// Returns a System.Diagnostics.Process pointing to
|
||||
// a pre-existing process with the same name as the
|
||||
// current one, if any; or null if the current process
|
||||
// is unique.
|
||||
{
|
||||
Process curr = Process.GetCurrentProcess();
|
||||
Process[] procs = Process.GetProcessesByName(curr.ProcessName);
|
||||
foreach (Process p in procs)
|
||||
{
|
||||
if ((p.Id != curr.Id) &&
|
||||
(p.MainModule.FileName == curr.MainModule.FileName))
|
||||
return p;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.20")]
|
||||
[assembly: AssemblyFileVersion("1.0.20")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.20")]
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.21")]
|
||||
[assembly: AssemblyFileVersion("1.0.21")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.21")]
|
||||
|
||||
@@ -78,8 +78,11 @@ namespace JiraTimeBot.TaskTime
|
||||
_log.Trace($"Погрешность распределения времени: {remainMinutes}. Добавляю к первой задаче.");
|
||||
}
|
||||
|
||||
//если переборщили или не достаточно добавили до 8 часов - скореектируем остаток в первой задаче (она самая трудозатратная).
|
||||
workTimeItems.First().Time += TimeSpan.FromMinutes(remainMinutes);
|
||||
if (workTimeItems.First().Time.TotalMinutes > Math.Abs(remainMinutes))
|
||||
{
|
||||
//если переборщили или не достаточно добавили до 8 часов - скореектируем остаток в первой задаче (она самая трудозатратная).
|
||||
workTimeItems.First().Time += TimeSpan.FromMinutes(remainMinutes);
|
||||
}
|
||||
|
||||
return workTimeItems;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using Autofac;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.DI;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using JiraTimeBot.Update;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.DI;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using JiraTimeBot.Update;
|
||||
|
||||
// This is the code for your desktop app.
|
||||
// Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
|
||||
|
||||
Reference in New Issue
Block a user