Custom Tool useage

Has anyone used the EpiMonthViewSingle tool? I would like to see an example. I think it is just what I need for my project but can’t find any information on how to use it. Specifically how to store an appointment or even get the start and end date from the tool. There is a save button but I don’t know how to use it.

The only thing I can point you towards is:

If you google how to use UltraMonthViewSingle it should give you an idea how to use EpiMonthViewSingle.

The one place I found EpiMonthViewSingle to be used on is Time and Expense Entry. Gist of it:

public Ice.Lib.Framework.EpiMonthViewSingle calMonthView;
this.calMonthView = new Ice.Lib.Framework.EpiMonthViewSingle();

this.mainDock1.calendarDock1.monthView1.calMonthView.CalendarInfo = trans.empCalendarInfo;
this.mainDock1.calendarDock1.monthView1.calMonthView.CalendarLook = trans.empCalendarLook;

// Infragistics.Win.UltraWinSchedule.Week is used as well etc.. for oTrans.empCalendarInfo.

To recap best option is googling Infragistics and looking possibly at Time and Expense Entry through dotPeek or Reflector.

2 Likes

They have some example code usually lurking around DataBinding - Schedule - Windows Forms
WinMonthViewSingle - Schedule - Windows Forms

I know it’s possible, it’s been a few years since I’ve done it.

Remember you have pretty much most of Infragistics at your disposal =)


Gist from E9:

// **************************************************
// Custom code for SalesOrderForm
// Created: 10/30/2014 8:50:46 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Epicor.Mfg.BO;
using Epicor.Mfg.UI;
using Epicor.Mfg.UI.Adapters;
using Epicor.Mfg.UI.Customization;
using Epicor.Mfg.UI.ExtendedProps;
using Epicor.Mfg.UI.FormFunctions;
using Epicor.Mfg.UI.FrameWork;
using Epicor.Mfg.UI.Searches;

//using Infragistics.Win;
//using Infragistics.Win.Misc;

//using Infragistics.Win.UltraMessageBox;
//using Infragistics.Win.UltraWinToolTip;
//using Infragistics.Shared;
//using Infragistics.Win.AppStyling.Runtime;
//using System.Drawing;

// Used for Managing Outlook Functions
using Outlook = Microsoft.Office.Interop.Outlook;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	public Infragistics.Win.UltraMessageBox.UltraMessageBoxManager ultraMessageBoxManager1;

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.testEmail.Click += new System.EventHandler(this.testEmail_Click);
		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.testEmail.Click -= new System.EventHandler(this.testEmail_Click);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void ShowContinueMessage(string message)
	{
		Infragistics.Shared.ResourceCustomizer rc = Infragistics.Win.Resources.Customizer;

		// Customize the text for the Ok MessageBox Button.
		rc.SetCustomizedString("MessageBoxButtonOK", "OK, Email Sales!");
		rc.SetCustomizedString("MessageBoxButtonCancel", "Cancel");

		this.ultraMessageBoxManager1 = new Infragistics.Win.UltraMessageBox.UltraMessageBoxManager();
	    using (Infragistics.Win.UltraMessageBox.UltraMessageBoxInfo ultraMessageBoxInfo = new Infragistics.Win.UltraMessageBox.UltraMessageBoxInfo())
	    {
	        // Set the general display style
	        ultraMessageBoxInfo.Style = Infragistics.Win.UltraMessageBox.MessageBoxStyle.Vista;

	        // Set the text for the Text, Caption, Header and Footer
	        ultraMessageBoxInfo.Text = message;
	        ultraMessageBoxInfo.Caption = "Problem with Part";
	        //ultraMessageBoxInfo.Header = "The Part you have entered does not exist or has no reference!";
	        ultraMessageBoxInfo.Footer = "NOTE: Outlook will Compose a New Email, please make sure you allow it.";

	        // Specify which buttons should be used and which is the default button
	        ultraMessageBoxInfo.Buttons = MessageBoxButtons.OKCancel;
	        ultraMessageBoxInfo.DefaultButton = MessageBoxDefaultButton.Button2;
	        ultraMessageBoxInfo.ShowHelpButton = Infragistics.Win.DefaultableBoolean.False;

	        // Display the OS Error Icon
	        ultraMessageBoxInfo.Icon = MessageBoxIcon.Warning;

	        // Disable the default sounds
	        ultraMessageBoxInfo.EnableSounds = Infragistics.Win.DefaultableBoolean.False;

		    // Set the Style so the dialog resembles the MessageBox as displayed on Vista
		    this.ultraMessageBoxManager1.Style = Infragistics.Win.UltraMessageBox.MessageBoxStyle.Vista;

		    // Change the alignment of the buttons
		    this.ultraMessageBoxManager1.ButtonAlignment = Infragistics.Win.HAlign.Center;

		    // Disable the playing of the default sounds
		    this.ultraMessageBoxManager1.EnableSounds = Infragistics.Win.DefaultableBoolean.False;

	        // Show the UltraMessageBox
	       DialogResult dialogResult = this.ultraMessageBoxManager1.ShowMessageBox(ultraMessageBoxInfo);

			if (dialogResult == DialogResult.OK)
			{
				bool mailSuccess = SendMail();
			}
	    }
	}

	public bool SendMail()
	{
		// Initialize Needed Objects and Variables
		Outlook.Application moApp = new Outlook.Application();;
		Outlook.MailItem oEmail = (Outlook.MailItem) moApp.CreateItem(Outlook.OlItemType.olMailItem);

		//
		// Compose New Email
		//
		try
		{
			oEmail.Recipients.Add("hasok@wow.com");
			oEmail.CC = "keric.haso@geemail.com";
			oEmail.Recipients.ResolveAll();
			oEmail.Subject = "Request: Part Missing or no Reference!";
			oEmail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
			oEmail.Body = "Blah, blah, blah... Bla Bla Bla Blu Bla Haso Bla...";
			oEmail.Importance = Outlook.OlImportance.olImportanceHigh;
			oEmail.ReadReceiptRequested = false;
			oEmail.Recipients.ResolveAll();
			oEmail.Save();
			oEmail.Display(true); /// Show the email message and allow for editing before sending
			/// oEmail.Send(); /// You can automatically send the email without displaying it.
		}
		catch (Exception eX)
        {
            MessageBox.Show("Email was not sent! You have failed to allow Epicor to manage Outlook!", "Dienetics Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return false;
        }


        //
        // Verify the Status of the Email
        //
        try
        {
	    	if (oEmail.Sent == false)
	    	{
            	MessageBox.Show("Email was not sent! You have not clicked the Send Button.", "Dienetics Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
	    		return false;
	    	}
        }
        catch (Exception ex)
        {
			MessageBox.Show("Email was sent successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
        	return true;
        }

        return true;
	}

	private void testEmail_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		ShowContinueMessage("Hey! In order to finish this order you must email sales!");
	}
}

UltraMessageBox ^ and Outlook just for @Chris_Conn :stuck_out_tongue:

1 Like

For the Red Alert / Notification:

// Reference: http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/HTML/Infragistics4.Win.Misc.v12.2~Infragistics.Win.Misc.UltraDesktopAlertShowWindowInfo~ScreenPosition.html
private void DesktopAlert()
{
Infragistics.Win.Misc.UltraDesktopAlert alert = new Infragistics.Win.Misc.UltraDesktopAlert();
alert.MultipleWindowDisplayStyle = Infragistics.Win.Misc.MultipleWindowDisplayStyle.None;
 
// Set the Opacity property to 90% opacity, to make the
// desktop alert window a little more noticable than it is with
// the default (80% opacity).
alert.Opacity = .9f;
 
// Use the link appearances to get a consistent foreground color across
// all links, and also so the font attributes are realized through the
// formatting and not the appearances.
Infragistics.Win.Appearance normalLinkAppearance = new Infragistics.Win.Appearance();
normalLinkAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.False;
normalLinkAppearance.FontData.Italic = Infragistics.Win.DefaultableBoolean.False;
normalLinkAppearance.FontData.Underline = Infragistics.Win.DefaultableBoolean.False;
normalLinkAppearance.ForeColor = System.Drawing.Color.White;
 
alert.CaptionAppearance = normalLinkAppearance;
alert.TextAppearance = normalLinkAppearance;
alert.FooterTextAppearance = normalLinkAppearance;
alert.CaptionHotTrackAppearance = normalLinkAppearance;
alert.TextHotTrackAppearance = normalLinkAppearance;
alert.FooterTextHotTrackAppearance = normalLinkAppearance;
 
// Set the GripAreaAppearance or CaptionAreaAppearance depending
// on the resolved Style...the GripAreaAppearance applies to the
// Office2007 style, and the CaptionAreaAppearance applies to the
// WindowsLiveMessenger style.
if ( alert.StyleResolved == Infragistics.Win.Misc.DesktopAlertStyle.Office2007 )
{
Infragistics.Win.Appearance gripAreaAppearance = new Infragistics.Win.Appearance();
gripAreaAppearance.BackColor = System.Drawing.Color.Red;
gripAreaAppearance.BackColor2 = System.Drawing.Color.Red;
gripAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump;
alert.GripAreaAppearance = gripAreaAppearance;
}
else
{
Infragistics.Win.Appearance captionAreaAppearance = new Infragistics.Win.Appearance();
captionAreaAppearance.BackColor = System.Drawing.Color.AliceBlue;
alert.CaptionAreaAppearance = captionAreaAppearance;
alert.CaptionAreaImageSize = new System.Drawing.Size( 12, 12 );
}
 
alert.Appearance.BackColor2 = System.Drawing.Color.Red;
alert.Appearance.BackColor = System.Drawing.Color.IndianRed;
 
Infragistics.Win.Misc.UltraDesktopAlertShowWindowInfo showInfo = new Infragistics.Win.Misc.UltraDesktopAlertShowWindowInfo();
 
// Set the key to uniquely identify this desktop alert window
showInfo.Key = "myWindow";
 
// Set the Caption, Text, and FooterText properties using formatting
// characters that are recognized by the FormattedTextUIElement.
showInfo.Caption = "Here comes the Title";
showInfo.Text = "Some Bold and skinny!"; // you can use HTML Tags!
//showInfo.FooterText = "Click to visit the Infragistics website";
 
// Use the ScreenPosition property to make the desktop alert
// window appear at the top left corner of the screen
showInfo.ScreenPosition = Infragistics.Win.Misc.ScreenPosition.Center;
 
//showInfo.ScreenLocation = new System.Drawing.Point(200, 200);
 
// Use the Screen property to specify which screen the desktop alert
// appears in...in the case where the end user has amultiple monitor
// setup, this will make the alert appear on the last screen
showInfo.Screen = Screen.AllScreens[Screen.AllScreens.Length - 1];
 
// Show Alert
alert.Show(showInfo);
}
5 Likes

Wow - wasn’t privy to that fancy UltraMessageBox. That is snazzy! You taught me something new @hkeric.wci , that makes for a good day.

1 Like

Woohoo!! Yes - thats why you should follow me on Twitter https://twitter.com/hasokeric you can make it look pretty neat-o with HTML Support and some Styles.

windowsforms-layouts-messagebox-manager-compatibility-sMessageBoxHeaderIssue

3 Likes

impressive stuff man!

2 Likes