/// <summary>
        /// Initializes a new instance of the <see cref="TaskActivityFilterDialog"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public PrintSetupDialog(TaskClerkEngine engine)
        {
            InitializeComponent();
            _engine           = engine;
            _taskDescriptions = new Collection <TaskDescription>();

            DateTime tempStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            DateTime tempEnd   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(1).Subtract(new TimeSpan(0, 0, 1));

            _start = (DateTime)_engine.SettingsProvider.Get("FilterStartDate", tempStart);
            _end   = (DateTime)_engine.SettingsProvider.Get("FilterEndDate", tempEnd);

            datetimepickerStartDate.Value = _start;
            datetimepickerStartTime.Value = _start;
            datetimepickerEndDate.Value   = _end;
            datetimepickerEndTime.Value   = _end;

            comboboxScheme.SelectedIndex = 0;
            ReBuildTree(_engine.TaskDescriptionsProvider.TaskDescriptions);

            this.datetimepickerEndTime.ValueChanged   += new System.EventHandler(this.ValueChanged);
            this.datetimepickerStartTime.ValueChanged += new System.EventHandler(this.ValueChanged);
            this.datetimepickerEndDate.ValueChanged   += new System.EventHandler(this.ValueChanged);
            this.datetimepickerStartDate.ValueChanged += new System.EventHandler(this.ValueChanged);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginPrintFormatter"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="config">The config.</param>
 public PluginPrintFormatter(TaskClerkEngine engine, PrintConfiguration config)
 {
     _engine = engine;
     _config = config;
     _currentPageNumber = 1;
     _font = (Font)_engine.SettingsProvider.Get("GeneralFont", SystemFonts.DefaultFont);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskActivityFilterDialog"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public PrintSetupDialog(TaskClerkEngine engine)
        {
            InitializeComponent();
            _engine = engine;
            _taskDescriptions = new Collection<TaskDescription>();

            DateTime tempStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            DateTime tempEnd = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(1).Subtract(new TimeSpan(0,0,1));

            _start = (DateTime)_engine.SettingsProvider.Get("FilterStartDate", tempStart);
            _end = (DateTime)_engine.SettingsProvider.Get("FilterEndDate", tempEnd);

            datetimepickerStartDate.Value = _start;
            datetimepickerStartTime.Value = _start;
            datetimepickerEndDate.Value = _end;
            datetimepickerEndTime.Value = _end;

            comboboxScheme.SelectedIndex = 0;
            ReBuildTree(_engine.TaskDescriptionsProvider.TaskDescriptions);

            this.datetimepickerEndTime.ValueChanged += new System.EventHandler(this.ValueChanged);
            this.datetimepickerStartTime.ValueChanged += new System.EventHandler(this.ValueChanged);
            this.datetimepickerEndDate.ValueChanged += new System.EventHandler(this.ValueChanged);
            this.datetimepickerStartDate.ValueChanged += new System.EventHandler(this.ValueChanged);
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginPrintFormatter"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="config">The config.</param>
 public PluginPrintFormatter(TaskClerkEngine engine, PrintConfiguration config)
 {
     _engine            = engine;
     _config            = config;
     _currentPageNumber = 1;
     _font = (Font)_engine.SettingsProvider.Get("GeneralFont", SystemFonts.DefaultFont);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrintSetupDialog"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public PrintSetupDialog(TaskClerkEngine engine) : this()
        {
            _engine = engine;

            PrepareFormatterList();
            LoadUIControlSettings();
            PrepareDescriptionsTree(_engine.TaskDescriptionsProvider.TaskDescriptions);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrintSetupDialog"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public PrintSetupDialog(TaskClerkEngine engine)
            : this()
        {
            _engine = engine;

            PrepareFormatterList();
            LoadUIControlSettings();
            PrepareDescriptionsTree(_engine.TaskDescriptionsProvider.TaskDescriptions);
        }
Esempio n. 7
0
 public PropertiesForm()
 {
     InitializeComponent();
     activitiesDraw1 = new ActivitiesDraw();
     panelActivityDraw.Controls.Add(activitiesDraw1);
     activitiesDraw1.Dock = DockStyle.Fill;
     _isReadyForEdit = false;
     _engine = AppContext.Current;
     _engine.TaskActivitiesProvider.TaskActivitiesChanged += new EventHandler<TaskActivityEventArgs>(TaskActivitiesProvider_TaskActivitiesChanged);
 }
Esempio n. 8
0
 public PropertiesForm()
 {
     InitializeComponent();
     activitiesDraw1 = new ActivitiesDraw();
     panelActivityDraw.Controls.Add(activitiesDraw1);
     activitiesDraw1.Dock = DockStyle.Fill;
     _isReadyForEdit      = false;
     _engine = AppContext.Current;
     _engine.TaskActivitiesProvider.TaskActivitiesChanged += new EventHandler <TaskActivityEventArgs>(TaskActivitiesProvider_TaskActivitiesChanged);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskActivitiesExplorer"/> class.
        /// </summary>
        public TaskActivitiesExplorer()
        {
            InitializeComponent();

            _engine = AppContext.Current;

            languageToolStripStatusLabel.Text = Thread.CurrentThread.CurrentCulture.Name;
            optionsToolStripMenuItem.Image = Resources.Options;
            webSiteToolStripMenuItem.Image = Resources.Home;
            statusPurchased.Image = Resources.Lock;
            statusRegistered.Image = Resources.Key;

            if (DesignMode == false)
            {
                LoadToolMenuPlugins();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskActivitiesExplorer"/> class.
        /// </summary>
        public TaskActivitiesExplorer()
        {
            InitializeComponent();

            _engine = AppContext.Current;

            languageToolStripStatusLabel.Text = Thread.CurrentThread.CurrentCulture.Name;
            optionsToolStripMenuItem.Image    = Resources.Options;
            webSiteToolStripMenuItem.Image    = Resources.Home;
            statusPurchased.Image             = Resources.Lock;
            statusRegistered.Image            = Resources.Key;

            if (DesignMode == false)
            {
                LoadToolMenuPlugins();
            }
        }
Esempio n. 11
0
        public ToDoExplorer(TaskClerkEngine engine)
        {
            InitializeComponent();
            _engine                  = engine;
            _todoTasks               = _engine.SettingsProvider.Get("ToDoTasks", new List <ToDoTask>()) as List <ToDoTask>;
            _options                 = _engine.SettingsProvider.Get("ToDoOptions", new ToDoOptions()) as ToDoOptions;
            listView.Font            = _engine.SettingsProvider.Get("GeneralFont", SystemFonts.DefaultFont) as Font;
            toolStripStatusLang.Text = Thread.CurrentThread.CurrentCulture.Name;

            GetFormSizeAndLocation();
            CreateGroupsInListView();
            PopulateListView();

            this.monthCalendar.DateSelected +=
                new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar_DateSelected);
            this.listView.ItemSelectionChanged +=
                new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView_ItemSelectionChanged);
        }
Esempio n. 12
0
        /// <summary>
        /// Creates the specified engine.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <returns></returns>
        internal TaskClerkProvider Create(TaskClerkEngine engine)
        {
            Regex expression =
                new Regex(BritishMicro.TaskClerk.Properties.Resources.TypeNameAndAssemblyRegEx);
            Match    m = expression.Match(_providerType);
            Assembly targetAssembly;

            try
            {
                targetAssembly = Assembly.Load(m.Groups["AssemblyName"].Value);
            }
            catch (FileNotFoundException fnf)
            {
                Trace.TraceError(
                    "TaskClerkProvider:Create[Unable to find the file {0}, specified in the providers section of the application configuration file.]",
                    fnf.FileName);
                throw new FileNotFoundException(
                          "Unable to find the file specified in the providers section of the application configuration file.",
                          fnf);
            }
            Type targetType = targetAssembly.GetType(m.Groups["TypeName"].Value);

            if (targetType == null)
            {
                Trace.TraceError("TaskClerkProvider:Create[Could not find type [{0}] in assembly [{1}].]",
                                 m.Groups["TypeName"].Value, targetAssembly.FullName);
                throw new InvalidOperationException(
                          string.Format(CultureInfo.InvariantCulture, "Could not find type [{0}] in assembly [{1}].",
                                        m.Groups["TypeName"].Value,
                                        targetAssembly.FullName));
            }
            TaskClerkProvider provider = Activator.CreateInstance(targetType) as TaskClerkProvider;

            if (provider != null)
            {
                provider._engine   = engine;
                provider._metadata = this._metadata;
                provider.OnInit();
            }
            return(provider);
        }
Esempio n. 13
0
 public ToDoItemDialog(TaskClerkEngine engine, ToDoTask toDoTask)
 {
     InitializeComponent();
     this._engine   = engine;
     this._todoTask = toDoTask;
 }
Esempio n. 14
0
 public ToDoItemDialog(TaskClerkEngine engine) : this(engine, new ToDoTask())
 {
 }
 /// <summary>
 /// Creates the specified engine.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <returns></returns>
 internal TaskClerkProvider Create(TaskClerkEngine engine)
 {
     Regex expression =
         new Regex(BritishMicro.TaskClerk.Properties.Resources.TypeNameAndAssemblyRegEx);
     Match m = expression.Match(_providerType);
     Assembly targetAssembly;
     try
     {
         targetAssembly = Assembly.Load(m.Groups["AssemblyName"].Value);
     }
     catch (FileNotFoundException fnf)
     {
         Trace.TraceError(
             "TaskClerkProvider:Create[Unable to find the file {0}, specified in the providers section of the application configuration file.]",
             fnf.FileName);
         throw new FileNotFoundException(
             "Unable to find the file specified in the providers section of the application configuration file.",
             fnf);
     }
     Type targetType = targetAssembly.GetType(m.Groups["TypeName"].Value);
     if (targetType == null)
     {
         Trace.TraceError("TaskClerkProvider:Create[Could not find type [{0}] in assembly [{1}].]",
                          m.Groups["TypeName"].Value, targetAssembly.FullName);
         throw new InvalidOperationException(
             string.Format(CultureInfo.InvariantCulture, "Could not find type [{0}] in assembly [{1}].",
                           m.Groups["TypeName"].Value,
                           targetAssembly.FullName));
     }
     TaskClerkProvider provider = Activator.CreateInstance(targetType) as TaskClerkProvider;
     if (provider != null)
     {
         provider._engine = engine;
         provider._metadata = this._metadata;
         provider.OnInit();
     }
     return provider;
 }
Esempio n. 16
0
        /// <summary>
        /// Creates the a 2D pie chart image.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="activities">The activities.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns></returns>
        public static Image CreatePie2D(TaskClerkEngine engine, Collection<TaskActivity> activities, int width, int height)
        {
            string graphViewStyle = (string)engine.SettingsProvider.Get("GraphViewStyle", "Minutes");
            string graphGroupStyle =
                (string)engine.SettingsProvider.Get("GraphGroupStyle", "Group by Task");

            decimal totalMinutes = 0;
            GraphData data = new GraphData();
            data.Title = string.Format("{0} / {1}", graphGroupStyle, graphViewStyle);
            foreach (TaskActivity activity in activities)
            {

                string label = activity.TaskDescription.Name;
                Color color = activity.TaskDescription.Color;
                if (activity.TaskDescription.IsEmpty())
                {
                    label = "Empty";
                    color = Color.Black;
                }

                if (graphGroupStyle == "Group by Category")
                {
                    TaskDescription category =
                        (TaskDescription)engine.TaskDescriptionsProvider.CategoryFromTaskDescription(activity.TaskDescription);
                    if (category != null)
                    {
                        label = category.Name;
                        color = category.Color;
                    }
                    else
                    {
                        label = "Unknown";
                        color = Color.Black;
                    }
                }

                // only show activities and activities that have at least 0.01 minute of duration.
                if ((!activity.TaskDescription.IsEvent) && (activity.Duration > 0))
                {
                    GraphRange range = data.FindGraphRange(label);
                    if (range == null)
                    {
                        range = new GraphRange(
                            label,
                            color,
                            Color.DimGray,
                            0);
                        data.Ranges.Add(range);
                    }
                    range.Values.Add(new GraphValue(activity.Duration));
                    totalMinutes += activity.Duration;
                }
            }

            switch (graphViewStyle)
            {
                case "Hours":
                    foreach (GraphRange gr in data.Ranges)
                    {
                        foreach (GraphValue gv in gr.Values)
                        {
                            gv.Point = gv.Point / 60;
                        }
                    }
                    break;
                case "Percent (%)":
                    double divider = (double)(totalMinutes / 100);
                    foreach (GraphRange gr in data.Ranges)
                    {
                        double tot = 0;
                        foreach (GraphValue gv in gr.Values)
                        {
                            tot += gv.Point;
                        }
                        double answer = tot / divider;
                        gr.Values.Clear();
                        gr.Values.Add(new GraphValue(answer));
                    }
                    break;
                default:
                    break;
            }

            //PieChart
            Pie2D pie = new Pie2D(data, width, height);
            Font temp = (Font)AppContext.Current.SettingsProvider.Get("GeneralFont", SystemFonts.DefaultFont);
            pie.TitleFont = new Font(temp.FontFamily, temp.Size+2, FontStyle.Regular);
            pie.LegendFont = new Font(temp.FontFamily, temp.Size, FontStyle.Regular);
            pie.DrawLegend = true;
            pie.DrawTitle = true;
            if (graphViewStyle == "Task")
            {
                pie.TextLabels = true;
            }
            pie.Paint();
            return pie.Bitmap;
        }
Esempio n. 17
0
 /// <summary>
 /// All addins get handed the EngineContext and the EnvironmentContext
 /// when they are initalized
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="hostControl">The host control.</param>
 public void PluginInit(TaskClerkEngine engine, Component hostControl)
 {
     _engine      = engine;
     _hostControl = hostControl;
     Router("OnTaskClerkInit");
 }
 /// <summary>
 /// All addins get handed the EngineContext and the EnvironmentContext
 /// when they are initalized
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="hostControl">The host control.</param>
 public void TaskClerkInit(TaskClerkEngine engine, Component hostControl)
 {
     _engine = engine;
     _hostControl = hostControl;
     Router("OnTaskClerkInit");
 }
Esempio n. 19
0
        /// <summary>
        /// Creates the a 2D pie chart image.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="activities">The activities.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns></returns>
        public static Image CreatePie2D(TaskClerkEngine engine, Collection <TaskActivity> activities, int width, int height)
        {
            string graphViewStyle  = (string)engine.SettingsProvider.Get("GraphViewStyle", "Minutes");
            string graphGroupStyle =
                (string)engine.SettingsProvider.Get("GraphGroupStyle", "Group by Task");

            decimal   totalMinutes = 0;
            GraphData data         = new GraphData();

            data.Title = string.Format("{0} / {1}", graphGroupStyle, graphViewStyle);
            foreach (TaskActivity activity in activities)
            {
                string label = activity.TaskDescription.Name;
                Color  color = activity.TaskDescription.Color;
                if (activity.TaskDescription.IsEmpty())
                {
                    label = "Empty";
                    color = Color.Black;
                }

                if (graphGroupStyle == "Group by Category")
                {
                    TaskDescription category =
                        (TaskDescription)engine.TaskDescriptionsProvider.CategoryFromTaskDescription(activity.TaskDescription);
                    if (category != null)
                    {
                        label = category.Name;
                        color = category.Color;
                    }
                    else
                    {
                        label = "Unknown";
                        color = Color.Black;
                    }
                }

                // only show activities and activities that have at least 0.01 minute of duration.
                if ((!activity.TaskDescription.IsEvent) && (activity.Duration > 0))
                {
                    GraphRange range = data.FindGraphRange(label);
                    if (range == null)
                    {
                        range = new GraphRange(
                            label,
                            color,
                            Color.DimGray,
                            0);
                        data.Ranges.Add(range);
                    }
                    range.Values.Add(new GraphValue(activity.Duration));
                    totalMinutes += activity.Duration;
                }
            }

            switch (graphViewStyle)
            {
            case "Hours":
                foreach (GraphRange gr in data.Ranges)
                {
                    foreach (GraphValue gv in gr.Values)
                    {
                        gv.Point = gv.Point / 60;
                    }
                }
                break;

            case "Percent (%)":
                double divider = (double)(totalMinutes / 100);
                foreach (GraphRange gr in data.Ranges)
                {
                    double tot = 0;
                    foreach (GraphValue gv in gr.Values)
                    {
                        tot += gv.Point;
                    }
                    double answer = tot / divider;
                    gr.Values.Clear();
                    gr.Values.Add(new GraphValue(answer));
                }
                break;

            default:
                break;
            }

            //PieChart
            Pie2D pie  = new Pie2D(data, width, height);
            Font  temp = (Font)AppContext.Current.SettingsProvider.Get("GeneralFont", SystemFonts.DefaultFont);

            pie.TitleFont  = new Font(temp.FontFamily, temp.Size + 2, FontStyle.Regular);
            pie.LegendFont = new Font(temp.FontFamily, temp.Size, FontStyle.Regular);
            pie.DrawLegend = true;
            pie.DrawTitle  = true;
            if (graphViewStyle == "Task")
            {
                pie.TextLabels = true;
            }
            pie.Paint();
            return(pie.Bitmap);
        }