DayLabel.cs :  » Business-Application » Timetabler » OpenCTT » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Business Application » Timetabler 
Timetabler » OpenCTT » DayLabel.cs
#region Open Course Timetabler - An application for school and university course timetabling
//
// Author:
//   Ivan urak (mailto:Ivan.Curak@fesb.hr)
//
// Copyright (c) 2007 Ivan urak, Split, Croatia
//
// http://www.openctt.org
//
//This file is part of Open Course Timetabler.
//
//Open Course Timetabler is free software;
//you can redistribute it and/or modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2 of the License,
//or (at your option) any later version.
//
//Open Course Timetabler is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
//or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//You should have received a copy of the GNU General Public License along with
//Open Course Timetabler; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
//Fifth Floor, Boston, MA  02110-1301  USA

#endregion

using System;
using System.Windows.Forms;
using System.Collections;
using System.Globalization;
using System.Resources;

namespace OpenCTT{
  /// <summary>
  /// Summary description for DayLabel.
  /// </summary>
  public class DayLabel:System.Windows.Forms.Label
  {
    private static ResourceManager RES_MANAGER;  

    private int _index;
    private string _text;

    private ContextMenu _labelContextMenu;

    public DayLabel(int x, int y, String text,int index)
    {
      if(RES_MANAGER==null)
      {
        RES_MANAGER = new System.Resources.ResourceManager("OpenCTT.MyStrings.DayLabel",this.GetType().Assembly);
      }

      _text=text;
      _index=index;

      this.Text=text;      

      this.Size=new System.Drawing.Size(Settings.TIME_SLOT_PANEL_WIDTH,Constants.DAY_HOUR_PANEL_HEIGHT);

      this.Location=new System.Drawing.Point(x,y);

      this.BackColor=System.Drawing.Color.Ivory;

      
      this.Font = new System.Drawing.Font("Arial", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(238)));
      this.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
      this.BorderStyle= System.Windows.Forms.BorderStyle.FixedSingle;  

      _labelContextMenu = new ContextMenu();
      this.ContextMenu=_labelContextMenu;      

      _labelContextMenu.Popup += new System.EventHandler(this._labelContextMenu_Popup);

      this.MouseEnter += new System.EventHandler(this.thisLabel_MouseEnter);
      this.MouseLeave += new System.EventHandler(this.thisLabel_MouseLeave);
      
    }

    private void _labelContextMenu_Popup(object sender, System.EventArgs e)
    {
  
      _labelContextMenu.MenuItems.Clear();
      
            MenuItem menuItem1 = new MenuItem(RES_MANAGER.GetString("_labelContextMenu_Popup.delDayMI.Text1")+" '"+_text+"' "+RES_MANAGER.GetString("_labelContextMenu_Popup.delDayMI.Text2"));

      menuItem1.Click += new System.EventHandler(this.delDay_Click);
      _labelContextMenu.MenuItems.Add(menuItem1);

    }

    private void thisLabel_MouseEnter(object sender, System.EventArgs e)
    {
      
      this.BackColor=System.Drawing.SystemColors.GrayText;
      
    }

    private void thisLabel_MouseLeave(object sender, System.EventArgs e)
    {
      this.BackColor=System.Drawing.Color.Ivory;      
    }

    private void delDay_Click(object sender, System.EventArgs e)
    {
      int dayIndexInModel=AppForm.CURR_OCTT_DOC.getDayIndexInModel(_index);

      if(ModelOperations.checkIfDayIsEmpty(dayIndexInModel))
      {
        DeleteDayCmd ddCmd= new DeleteDayCmd(_index);
        CommandProcessor.getCommandProcessor().doCmd(ddCmd);        
      }
      else
      {
      
                string message;

        if(AppForm.CURR_OCTT_DOC.DocumentType==Constants.OCTT_DOC_TYPE_UNIVERSITY)
        {
                    message = RES_MANAGER.GetString("delDay_Click.msb.daynotdeleted.university.message");

        }
        else
        {
          message = RES_MANAGER.GetString("delDay_Click.msb.daynotdeleted.school.message");
                        
        }
        
        string caption = RES_MANAGER.GetString("delDay_Click.msb.daynotdeleted.caption");
        MessageBoxButtons buttons = MessageBoxButtons.OK;
    
        MessageBox.Show(this, message, caption, buttons,
          MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

      }
    }

  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.