using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using IReaper.CourseData;
using IReaper.FileData;
using IReaper.CommonGui;
using IReaper.Command;
namespace IReaper.CourseData{
public partial class CourseDataGridViewContextMenu : ContextMenuStrip
{
Course context;
/// <summary>
///
/// </summary>
public Course ContextCourse
{
get { return context; }
set { context = value; }
}
public CourseDataGridViewContextMenu()
{
InitializeComponent();
}
public CourseDataGridViewContextMenu(IContainer container)
{
container.Add(this);
InitializeComponent();
}
/// <summary>
/// MenuItem
/// </summary>
private void UpdateMenuItemStatue(object sender, CancelEventArgs e)
{
//update open,download,remove,export
ButtonStatuMonitor.DataType = CoreDataType.CurrentSelectedCourses;
this.toolStripMenuItemDownload.Enabled = ButtonStatuMonitor.CanDownload;
this.toolStripMenuItemOpen.Enabled = ButtonStatuMonitor.CanOpen;
this.toolStripMenuItemRemove.Enabled = ButtonStatuMonitor.CanRemove;
this.toolStripMenuItemExport.Enabled = ButtonStatuMonitor.CanExport;
//update property
this.toolStripMenuItemProperty.Enabled = ButtonStatuMonitor.CanProperty;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OpenWebSite(object sender, EventArgs e)
{
//
if (this.context == null)
{ return; }
Browser.BrowserManager.OpenWebsite(this.context.CourseUrl);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InvokeReminder(object sender, EventArgs e)
{
CommandBase command = CommandManager.GetCommand(CommandFamily.Command_RevertRemind);
command.Execute(this, null);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UpdateReminder(object sender, EventArgs e)
{
bool isAuto = Properties.Settings.Default.RemindAllNewCourse;
Properties.Settings.Default.RemindAllNewCourse = !isAuto;
Properties.Settings.Default.Save();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OpenProperty(object sender, EventArgs e)
{
if (this.context == null)
{ return; }
CourseProperties property = new CourseProperties(this.context);
property.ShowDialog();
}
}
}
|