This commit is contained in:
2018-06-29 19:47:36 +00:00
commit be7f501333
3769 changed files with 1425961 additions and 0 deletions

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{19024613-F5C6-42A5-B02D-CECD8B20BF77}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AyaNova.Plugin.QuickNotification</RootNamespace>
<AssemblyName>AyaNova.Plugin.QuickNotification</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\keys\AyaNova.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\WinFormApp\bin\debug\plugins\QuickNotification\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QuickNotificationCompose.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="QuickNotificationCompose.Designer.cs">
<DependentUpon>QuickNotificationCompose.cs</DependentUpon>
</Compile>
<Compile Include="Resource.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="QuickNotification.cs" />
<Compile Include="Timestamp.cs" />
<Compile Include="Win32Utility.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\AyaNova.PlugIn\AyaNova.PlugIn.csproj">
<Project>{674BC3C9-4F74-4304-91ED-2EAFFFEB09A7}</Project>
<Name>AyaNova.PlugIn</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\bizobjects\AyaLib\GZTW.AyaNova.BLL.csproj">
<Project>{50B807B6-FC35-4CC3-B54D-91C78426A943}</Project>
<Name>GZTW.AyaNova.BLL</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\csla10\CSLA.Core.Bindablebase\CSLA.Core.Bindablebase.csproj">
<Project>{C2392355-12A9-4197-A1D3-603C390B1E62}</Project>
<Name>CSLA.Core.Bindablebase</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\csla10\CSLA.Server.DataPortal\CSLA.Server.DataPortal.vbproj">
<Project>{80828E2C-E9FB-4E73-A27C-7F9CDB96FCDE}</Project>
<Name>CSLA.Server.DataPortal</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\csla10\CSLA\CSLA.vbproj">
<Project>{1B9A38BB-461A-47A4-AD72-099C694138A0}</Project>
<Name>CSLA</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Data\Data\GZTW.Data.csproj">
<Project>{701893AA-C042-4FB2-8643-E139372C1117}</Project>
<Name>GZTW.Data</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Profile\GZTW.Profile\GZTW.Profile.csproj">
<Project>{EDE897E2-E2E6-441D-9F83-0B973AE09670}</Project>
<Name>GZTW.Profile</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="QuickNotificationCompose.resx">
<DependentUpon>QuickNotificationCompose.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\QuickNotification16.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\QuickNotification32.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\QuickNotification.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>"C:\data\AyaNova\utils\TimeStamp\bin\Release\TimeStamp.exe" "$(ProjectDir)Timestamp.cs" "/N:AyaNova.PlugIn.QuickNotification"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("AyaNova.Plugin.QuickNotification")]
[assembly: AssemblyDescription("QuickNotification plugin for AyaNova")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ground Zero Tech-Works Inc.")]
[assembly: AssemblyProduct("AyaNova.Plugin.QuickNotification")]
[assembly: AssemblyCopyright("Copyright © 2009-2018 Ground Zero Tech-Works Inc.")]
[assembly: AssemblyTrademark("AyaNova is a registered trademark of Ground Zero Tech-Works Inc.")]
[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("3057dcf8-655f-4fd6-8c58-edabe78abbe7")]
// 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.*")]
[assembly: AssemblyVersion("7.5.0.0")]
[assembly: AssemblyFileVersion("7.5.0.0")]

View File

@@ -0,0 +1,831 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AyaNova.PlugIn;
using GZTW.AyaNova.BLL;
using System.ComponentModel;
namespace AyaNova.Plugin.QuickNotification
{
public class QuickNotification : IAyaNovaPlugin
{
//Keep all the object types we want to deal with in a collection
//so that we can quickly check it when asked
private static List<RootObjectTypes> ObjectsWeCanDealWith = null;
private static bool bLicensed = false;
//Holds the image resources from AyaNova
//so we can display the correct icons in our plugin
System.Resources.ResourceManager resman = null;
//Holds the current logged in user's localized text
//lookup object
LocalizedTextTable LocaleText = null;
#region IAyaNovaPlugin Members
#region interface properties
public string PluginName
{
get { return "QuickNotification"; }
}
public string PluginVersion
{
get { return "7.5"; }
}
public string About
{
get
{
return "AyaNova QuickNotification plugin\r\n" +
"Built " + AyaNova.PlugIn.QuickNotification.Timestamp.BuildAt.ToString() + "\r\n" +
"Copyright 2009-2018 Ground Zero Tech-Works Inc.";
}
}
public Guid PluginID
{
get { return new Guid("{5B0CBFEB-E6A0-4005-B0AA-CD5C9A2A7E97}"); }
}
public System.Drawing.Image PluginSmallIcon
{
get { return Resource.QuickNotification16; }
}
public System.Drawing.Image PluginLargeIcon
{
get { return Resource.QuickNotification32; }
}
public System.Resources.ResourceManager AyaNovaResourceManager
{
set { resman = value; }
get { return resman; }
}
#endregion interface properties
#region Initialization and Close
public bool Initialize(Version AyaNovaVersion, LocalizedTextTable localizedText)
{
LocaleText = localizedText;
// bLicensed = (!string.IsNullOrEmpty(AyaBizUtils.PluginLicensedVersion("QuickNotification")));
//case 2094
bLicensed = AyaBizUtils.PluginAllowed("QuickNotification", AyaNova.PlugIn.QuickNotification.Timestamp.BuildAt);
if (!bLicensed && AyaBizUtils.PluginTooNew("QuickNotification", AyaNova.PlugIn.QuickNotification.Timestamp.BuildAt))
{
MessageBox.Show(
"NOT LICENSED!\r\n\r\nThis Quick Notification plugin was built " +
AyaNova.PlugIn.QuickNotification.Timestamp.BuildAt.ToString() + "\r\n" +
"but your license subscription for it ended " +
AyaBizUtils.PluginSubscriptionDate("QuickNotification").ToString() + "\r\n" +
"\r\nDowngrade back to your previous version or purchase a subscription to use this plugin.");
return false;
}
if (AyaNovaVersion.Major < 7)
{
MessageBox.Show("This QuickNotification plugin requires AyaNova version 7 or newer");
return false;
}
ObjectsWeCanDealWith = new List<RootObjectTypes>();
ObjectsWeCanDealWith.Add(RootObjectTypes.Nothing);
ObjectsWeCanDealWith.Add(RootObjectTypes.User);
ObjectsWeCanDealWith.Add(RootObjectTypes.Schedule);
ObjectsWeCanDealWith.Add(RootObjectTypes.WorkorderService);
ObjectsWeCanDealWith.Add(RootObjectTypes.Workorder);
ObjectsWeCanDealWith.Add(RootObjectTypes.Memo);
return true;
}
public void Close()
{
;
}
#endregion Initialization and close
#region ShowMenu?
public bool SingleObjectMenuShow(RootObjectTypes objectType)
{
return (ObjectsWeCanDealWith.Contains(objectType));
}
public bool MultipleObjectsMenuShow(RootObjectTypes objectType)
{
return (ObjectsWeCanDealWith.Contains(objectType));
}
#endregion show menu?
#region Menu options
public List<AyaNovaPluginMenuItem> SingleObjectMenuOptions(RootObjectTypes objectType, object ayaNovaObject)
{
if (!ObjectsWeCanDealWith.Contains(objectType)) return null;
if (!PFC()) return null;
List<AyaNovaPluginMenuItem> list = new List<AyaNovaPluginMenuItem>();
switch (objectType)
{
default:
//If it's not nothing and we already know it's something we can deal with
//then present the export
list.Add(new AyaNovaPluginMenuItem("MESSAGE_SELECTED", "Send quick notification", null, null));
break;
}
return list;
}
public List<AyaNovaPluginMenuItem> MultipleObjectsMenuOptions(RootObjectTypes objectType)
{
if (!ObjectsWeCanDealWith.Contains(objectType)) return null;
if (!PFC()) return null;
if (objectType == RootObjectTypes.Nothing) return null;
List<AyaNovaPluginMenuItem> list = new List<AyaNovaPluginMenuItem>();
list.Add(new AyaNovaPluginMenuItem("MESSAGE_SELECTED", "Send quick notification", null, null));
return list;
}
/// <summary>
/// pre flight check
/// </summary>
/// <returns></returns>
private bool PFC()
{
if (!bLicensed)
{
ShowWarning("An AyaNova QuickNotification license is required to use this plugin.", "Not licensed");
return false;
}
if (AyaBizUtils.Lite)
{
ShowWarning("QuickNotification can not be used with AyaNova Lite edition.", "AyaNova Lite not supported");
return false;
}
if (!AyaBizUtils.GlobalSettings.UseNotification)
{
ShowWarning("This QuickNotification plugin uses AyaNova notification services.\r\n" +
"Currently \"Use notification\" is set to False in AyaNova Global settings.\r\n" +
"Set it to True to proceed.", "Notification is off");
return false;
}
if (Subscribers.Count == 0)
{
ShowWarning("No users are subscribed to the \"Quick Notification\" event in AyaNova.\r\n" +
"Only users subscribing to the \"Quick Notification\" event in their notification subscriptions\r\n" +
"can be sent quick notifications.",
"No users can be notified");
return false;
}
return true;
}
private void ShowWarning(string swarn, string scaption)
{
MessageBox.Show(swarn, scaption, MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
#endregion
#region Menu Commands
#region LIST OBJECT COMMAND
/// <summary>
/// LIST OBJECT
/// </summary>
/// <param name="commandKey"></param>
/// <param name="objectType"></param>
/// <param name="objectIDList"></param>
/// <param name="listObject"></param>
/// <returns></returns>
public bool CommandSelectedForList(string commandKey, RootObjectTypes objectType, List<Guid> objectIDList, object listObject)
{
NotifyList.Clear();
upl = null;//case 3115
bool bAllItemsInGridWereSelected = objectIDList.Count == 0;
if (commandKey == "MESSAGE_SELECTED")
{
switch (objectType)
{
case RootObjectTypes.Schedule:
{
#region From schedule form
bool bHasAppointments = false;
//appointements
if (listObject != null && listObject is System.Collections.Generic.List<AppointmentList.AppointmentListInfo>)
{
System.Collections.Generic.List<AppointmentList.AppointmentListInfo> aptlist = (System.Collections.Generic.List<AppointmentList.AppointmentListInfo>)listObject;
if (aptlist.Count > 0) bHasAppointments = true;
foreach (AppointmentList.AppointmentListInfo apt in aptlist)
{
switch (apt.SourceObjectType)
{
case RootObjectTypes.WorkorderItemScheduledUser:
{
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.WorkorderItemScheduledUser"), apt.AppliesToObjectID,true);
}
break;
case RootObjectTypes.ScheduleMarker:
{
#region schedmarkers
////Could be a bunch by region , global , dispatchzone, schedusergroup
////or could be a single by one user ID
switch (apt.AppliesToObjectType)
{
case RootObjectTypes.User:
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
break;
case RootObjectTypes.Region:
{
//Loop through all active scheduleable users
//if the region ID matches the marker region ID then
//add a marker on the calendar for it
foreach (UserListScheduleable.UserListScheduleableInfo ui in UserList)
{
if (!ui.Active) continue;
//case 58
if (apt.AppliesToObjectID == GZTW.AyaNova.BLL.Region.DefaultRegionID)//SM is for default region? Then applies to everyone
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
else if (ui.RegionID == GZTW.AyaNova.BLL.Region.DefaultRegionID)//User is in default region? Then applies to them
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
else if (ui.RegionID == apt.AppliesToObjectID)//SM and User in same non default region
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
else continue;//no match
}
}
break;
case RootObjectTypes.DispatchZone:
{
//Loop through all active scheduleable users
//if the Dispatch zone ID matches the marker zone ID then
//add a marker on the calendar for it
foreach (UserListScheduleable.UserListScheduleableInfo ui in UserList)
if (ui.Active && ui.DispatchZoneID == apt.AppliesToObjectID)
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
}
break;
case RootObjectTypes.ScheduleableUserGroup:
{
ScheduleableUserGroupUsersList ScheduleMarkerGroup = ScheduleableUserGroupUsersList.GetList(apt.AppliesToObjectID);
//Loop through all active scheduleable users
//if they are in the ScheduleableUserGroup then
//add a marker on the calendar for it
foreach (UserListScheduleable.UserListScheduleableInfo ui in UserList)
if (ui.Active && ScheduleMarkerGroup.Contains(ui.ID))
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
}
break;
case RootObjectTypes.Global:
{
//WARNING: this code makes the assumption that
//all ACTIVE users are in the calendar owner collection
//and does not check to see if they exist or not
//Loop through all active scheduleable users
//add a marker on the calendar for each one as this applies to everyone
foreach (UserListScheduleable.UserListScheduleableInfo ui in UserList)
if (ui.Active)
InsertItem(apt.Subject, LocaleText.GetLocalizedText("O.ScheduleMarker"), apt.AppliesToObjectID,true);
}
break;
}
#endregion schedmarkers
}
break;
}
}
}
//all user resources
foreach (Guid id in objectIDList)
InsertItem(LocaleText.GetLocalizedText("UserTypes.Label.Schedulable"), LocaleText.GetLocalizedText("O.ScheduleForm"), id,!bHasAppointments);
#endregion From schedule form
}
break;
case RootObjectTypes.User:
{
#region user list form
if (bAllItemsInGridWereSelected)
{
UserList ul = (UserList)listObject;
foreach (UserList.UserListInfo i in ul)
InsertItem("", LocaleText.GetLocalizedText("O.User"), i.LT_User_Label_LastName.Value, true);
}
else
{
foreach (Guid g in objectIDList)
InsertItem("", LocaleText.GetLocalizedText("O.User"), g, true);
}
#endregion
}
break;
case RootObjectTypes.WorkorderService:
{
#region Service wo tree lists
Type t = listObject.GetType();
switch (t.Name)
{
case "WorkorderServiceList":
{
WorkorderServiceList l = (WorkorderServiceList)listObject;
foreach (WorkorderServiceList.WorkorderServiceListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_O_Workorder.Value))
{
//iterate all users in wo
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorder(w, i.LT_O_Workorder.Display);
}
}
}
break;
case "WorkorderServiceScheduledUserList":
{
WorkorderServiceScheduledUserList l = (WorkorderServiceScheduledUserList)listObject;
string sourcecat = LocaleText.GetLocalizedText(l.LocaleKey);
foreach (WorkorderServiceScheduledUserList.WorkorderServiceScheduledUserListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemScheduledUser_Label_ID))
{
InsertItem(i.LT_O_Workorder.Display +
" - " +
i.LT_WorkorderItemScheduledUser_Label_StartDate.ToString(),
sourcecat,
i.LT_WorkorderItemScheduledUser_Label_UserID.Value,
true);
}
}
}
break;
case "WorkorderServiceLaborList":
{
WorkorderServiceLaborList l = (WorkorderServiceLaborList)listObject;
string sourcecat = LocaleText.GetLocalizedText(l.LocaleKey);
foreach (WorkorderServiceLaborList.WorkorderServiceLaborListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemLabor_Label_ID))
InsertItem(i.LT_O_Workorder.Display +
" - " +
i.LT_WorkorderItemLabor_Label_ServiceStartDate.ToString(),
sourcecat,
i.LT_WorkorderItemLabor_Label_UserID.Value,
true);
}
}
break;
case "WorkorderServiceTravelList":
{
WorkorderServiceTravelList l = (WorkorderServiceTravelList)listObject;
string sourcecat = LocaleText.GetLocalizedText(l.LocaleKey);
foreach (WorkorderServiceTravelList.WorkorderServiceTravelListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemTravel_Label_ID))
InsertItem(i.LT_O_Workorder.Display +
" - " +
i.LT_WorkorderItemTravel_Label_TravelStartDate.ToString(),
sourcecat,
Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderItemTravel,i.LT_WorkorderItemTravel_Label_ID).WorkorderItems[i.LT_WorkorderItem_Label_ID].Travels[i.LT_WorkorderItemTravel_Label_ID.ToString()].UserID,
true);
}
}
break;
case "WorkorderServiceItemList":
{
WorkorderServiceItemList l = (WorkorderServiceItemList)listObject;
foreach (WorkorderServiceItemList.WorkorderServiceItemListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItem_Label_ID))
{
//iterate all users in wo item
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorderItemUsers(w.WorkorderItems[i.LT_WorkorderItem_Label_ID], i.LT_O_Workorder.Display);
}
}
}
break;
case "WorkorderServicePartList":
{
WorkorderServicePartList l = (WorkorderServicePartList)listObject;
foreach (WorkorderServicePartList.WorkorderServicePartListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemPart_Label_ID))
{
//iterate all users in wo item
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorderItemUsers(w.WorkorderItems[i.LT_WorkorderItem_Label_ID], i.LT_O_Workorder.Display);
}
}
}
break;
case "WorkorderServiceLoanList":
{
WorkorderServiceLoanList l = (WorkorderServiceLoanList)listObject;
foreach (WorkorderServiceLoanList.WorkorderServiceLoanListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemLoan_Label_ID))
{
//iterate all users in wo item
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorderItemUsers(w.WorkorderItems[i.LT_WorkorderItem_Label_ID], i.LT_O_Workorder.Display);
}
}
}
break;
case "WorkorderServiceExpenseList":
{
WorkorderServiceExpenseList l = (WorkorderServiceExpenseList)listObject;
foreach (WorkorderServiceExpenseList.WorkorderServiceExpenseListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItemMiscExpense_Label_ID))
{
//iterate all users in wo item
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorderItemUsers(w.WorkorderItems[i.LT_WorkorderItem_Label_ID], i.LT_O_Workorder.Display);
}
}
}
break;
case "WorkorderServiceCustomList":
{
WorkorderServiceCustomList l = (WorkorderServiceCustomList)listObject;
foreach (WorkorderServiceCustomList.WorkorderServiceCustomListInfo i in l)
{
if (bAllItemsInGridWereSelected || objectIDList.Contains(i.LT_WorkorderItem_Label_ID))
{
//iterate all users in wo item
Workorder w = Workorder.GetItemNoMRU(i.LT_O_Workorder.Value);
InsertWorkorderItemUsers(w.WorkorderItems[i.LT_WorkorderItem_Label_ID], i.LT_O_Workorder.Display);
}
}
}
break;
default:
return false;
}
#endregion
}
break;
case RootObjectTypes.Memo:
{
#region memo
string language=User.CurrentUserLanguage;
if (bAllItemsInGridWereSelected)
{
MemoList ml = (MemoList)listObject;
foreach(MemoList.MemoListInfo i in ml)
{
MemoFetcher m = MemoFetcher.GetItem(i.ID, language);
InsertItem(LocaleText.GetLocalizedText("O.Memo"), m.ShortHeader.Replace("\r\n", " "), m.FromID, true);
}
}
else
{
foreach (Guid g in objectIDList)
{
MemoFetcher m = MemoFetcher.GetItem(g, language);
InsertItem(LocaleText.GetLocalizedText("O.Memo"), m.ShortHeader.Replace("\r\n", " "), m.FromID, true);
}
}
#endregion
}
break;
default:
return false;
}
}
ShowQuickNotifyForm();
return false;
}
#endregion list object command
#region SINGLE OBJECT COMMAND
/// <summary>
/// SINGLE OBJECT
/// </summary>
/// <param name="commandKey"></param>
/// <param name="objectType"></param>
/// <param name="ayaNovaObject"></param>
public void CommandSelectedForSingleObject(string commandKey, RootObjectTypes objectType, object ayaNovaObject)
{
NotifyList.Clear();
upl = null;//case 3115
switch (commandKey)
{
case "MESSAGE_SELECTED":
{
switch (objectType)
{
case RootObjectTypes.User:
{
if(ayaNovaObject!=null && ayaNovaObject is User)
InsertItem("", LocaleText.GetLocalizedText("O.User"), ((User)ayaNovaObject).ID, true);
}
break;
case RootObjectTypes.Nothing:
{
foreach (UserPickList.UserPickListInfo i in UserList)
{
if(i.Type == UserTypes.Schedulable || i.Type==UserTypes.NonSchedulable || i.Type==UserTypes.Administrator)
InsertItem("All Users", LocaleText.GetLocalizedText("O.User"), i.ID, true);
}
}
break;
case RootObjectTypes.Workorder:
{
if (ayaNovaObject != null && ayaNovaObject is Workorder)
InsertWorkorder((Workorder)ayaNovaObject, "");
}
break;
case RootObjectTypes.Memo:
{
#region memo
string language = User.CurrentUserLanguage;
if (ayaNovaObject != null && ayaNovaObject is MemoFetcher)
{
MemoFetcher m = (MemoFetcher)ayaNovaObject;
InsertItem(LocaleText.GetLocalizedText("O.Memo"), m.ShortHeader.Replace("\r\n", " "), m.FromID, true);
}
#endregion
}
break;
default:
return;
}
}
break;
}
ShowQuickNotifyForm();
}
#endregion single object command
#region Insert workorder users
private void InsertWorkorder(Workorder w, string workorderdisplay)
{
if (string.IsNullOrEmpty(workorderdisplay))
workorderdisplay = w.WorkorderService.ServiceNumber.ToString();
foreach (WorkorderItem wi in w.WorkorderItems)
{
InsertWorkorderItemUsers(wi,workorderdisplay);
}
}
private void InsertWorkorderItemUsers(WorkorderItem wi, string workorderdisplay)
{
string sourcecat = "";
sourcecat = LocaleText.GetLocalizedText("O.WorkorderItemScheduledUser");
foreach (WorkorderItemScheduledUser su in wi.ScheduledUsers)
{
InsertItem(workorderdisplay + " - " + su.StartDate.ToString(), sourcecat, su.UserID, true);
}
sourcecat = LocaleText.GetLocalizedText("O.WorkorderItemLabor");
foreach (WorkorderItemLabor su in wi.Labors)
{
InsertItem(workorderdisplay + " - " + su.ServiceStartDate.ToString(), sourcecat, su.UserID, true);
}
sourcecat = LocaleText.GetLocalizedText("O.WorkorderItemTravel");
foreach (WorkorderItemTravel su in wi.Travels)
{
InsertItem(workorderdisplay + " - " + su.TravelStartDate.ToString(), sourcecat, su.UserID, true);
}
}
#endregion insert workorder users
#endregion menu commands
#region QuickNotifyForm
/// <summary>
/// Show the form, take the selections and send the messages
/// </summary>
public void ShowQuickNotifyForm()
{
NotifyList.AllowNew = false;
QuickNotificationCompose qn = new QuickNotificationCompose(this);
DialogResult dr=qn.ShowDialog();
NotifyList.AllowNew = true;
if (dr == DialogResult.OK)
{
if (HasSelectedUsers && qn.HasSomethingToSend)
{
foreach (Guid id in SelectedUserList)
{
NotifyEvent.AddOrUpdateEvent(RootObjectTypes.User, id, (int)UserEvent.QuickNotification, id, qn.MesageToSend.Trim());
}
}
}
qn.Dispose();
}
#endregion quicknotifyform
#endregion
#region Notify subscribers
private List<Guid> mSubscribers;
public List<Guid> Subscribers
{
get
{
if (mSubscribers == null)
mSubscribers = NotifySubscribersListFetcher.GetItem((int)UserEvent.QuickNotification, RootObjectTypes.User, Guid.Empty);
return mSubscribers;
}
}
#endregion
#region BindingList
UserPickList upl;
public UserPickList UserList
{
get
{
if (upl == null)
upl = UserPickList.GetList(false);
return upl;
}
}
public void InsertItem(string source, string category, Guid userID, bool bSend)
{
if (userID == Guid.Empty) return;
//case 3115 - weed out empty users
UserPickList.UserPickListInfo upi = UserList[userID.ToString()];
if (!upi.Active)
return;
if (!Subscribers.Contains(userID)) bSend = false;
NotifyList.Add(new NotifyItem(category, source.Replace("\r\n"," "), UserList[userID], userID,bSend));
}
//http://msdn.microsoft.com/en-us/library/ms132679.aspx
BindingList<NotifyItem> mNotifyList;
public BindingList<NotifyItem> NotifyList
{
get
{
if (mNotifyList == null)
{
mNotifyList = new BindingList<NotifyItem>();
mNotifyList.AllowNew = true;
mNotifyList.AllowRemove = false;
mNotifyList.RaiseListChangedEvents = true;
mNotifyList.AllowEdit = true;
}
return mNotifyList;
}
}
public void CheckAllForUser(bool bCheck, Guid UserID)
{
foreach (NotifyItem i in NotifyList)
{
if (i.UserID == UserID)
i.Send = bCheck;
}
}
public void CheckAll(bool bCheck)
{
if (NotifyList.Count == 0) return;
foreach (NotifyItem i in NotifyList)
if (Subscribers.Contains(i.UserID)) i.Send = bCheck;
}
public bool HasSelectedUsers
{
get
{
foreach (NotifyItem i in NotifyList)
if (i.Send) return true;
return false;
}
}
public System.Collections.Generic.List<Guid> SelectedUserList
{
get
{
System.Collections.Generic.List<Guid> lsSelected = new List<Guid>();
foreach (NotifyItem i in NotifyList)
{
if (i.Send)
{
if (!lsSelected.Contains(i.UserID))
lsSelected.Add(i.UserID);
}
}
return lsSelected;
}
}
void NotifyList_ListChanged(object sender, ListChangedEventArgs e)
{
//MessageBox.Show(e.ListChangedType.ToString());
}
#endregion binding list
}
#region NotifyItem
public class NotifyItem //: INotifyPropertyChanged
{
public NotifyItem() { }
public NotifyItem( string category, string source, string username, Guid userID, bool bSend)
{
mUserID = userID;
mSource = source;
mUserName = username;
mCategory = category;
mSend = bSend;
}
private string mCategory;
private Guid mUserID;
private string mSource;
private string mUserName;
private bool mSend;
public string Category { get { return mCategory; } set { mCategory = value; } }
public string Source { get { return mSource; } set { mSource = value; } }
[Browsable(false)]
public Guid UserID { get { return mUserID; } set { mUserID = value; } }
public string UserName { get { return mUserName; } set { mUserName = value; } }
public bool Send
{
get
{
return mSend;
}
set
{
// if (mSend != value)
//{
mSend = value;
// NotifyPropertyChanged("Send");
//}
}
}
//public event PropertyChangedEventHandler PropertyChanged;
//private void NotifyPropertyChanged(String info)
//{
// if (PropertyChanged != null)
// {
// PropertyChanged(this, new PropertyChangedEventArgs(info));
// }
//}
}
#endregion
}

View File

@@ -0,0 +1,147 @@
namespace AyaNova.Plugin.QuickNotification
{
partial class QuickNotificationCompose
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tbMsg = new System.Windows.Forms.TextBox();
this.grid = new System.Windows.Forms.DataGridView();
this.btnSend = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.ckAll = new System.Windows.Forms.CheckBox();
this.tbSubject = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout();
//
// tbMsg
//
this.tbMsg.AcceptsReturn = true;
this.tbMsg.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbMsg.Location = new System.Drawing.Point(0, 38);
this.tbMsg.MaxLength = 1024;
this.tbMsg.Multiline = true;
this.tbMsg.Name = "tbMsg";
this.tbMsg.Size = new System.Drawing.Size(755, 191);
this.tbMsg.TabIndex = 0;
//
// grid
//
this.grid.AllowUserToAddRows = false;
this.grid.AllowUserToDeleteRows = false;
this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Location = new System.Drawing.Point(0, 258);
this.grid.Name = "grid";
this.grid.RowHeadersVisible = false;
this.grid.Size = new System.Drawing.Size(755, 173);
this.grid.TabIndex = 1;
this.grid.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellValueChanged);
this.grid.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.grid_ColumnHeaderMouseClick);
this.grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellClick);
this.grid.CurrentCellDirtyStateChanged += new System.EventHandler(this.grid_CurrentCellDirtyStateChanged);
//
// btnSend
//
this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSend.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnSend.Location = new System.Drawing.Point(673, 454);
this.btnSend.Name = "btnSend";
this.btnSend.Size = new System.Drawing.Size(75, 35);
this.btnSend.TabIndex = 2;
this.btnSend.UseVisualStyleBackColor = true;
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(13, 454);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 35);
this.btnCancel.TabIndex = 3;
this.btnCancel.UseVisualStyleBackColor = true;
//
// ckAll
//
this.ckAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ckAll.AutoSize = true;
this.ckAll.Checked = true;
this.ckAll.CheckState = System.Windows.Forms.CheckState.Checked;
this.ckAll.Location = new System.Drawing.Point(718, 235);
this.ckAll.Name = "ckAll";
this.ckAll.Size = new System.Drawing.Size(37, 17);
this.ckAll.TabIndex = 4;
this.ckAll.Text = "All";
this.ckAll.UseVisualStyleBackColor = true;
this.ckAll.CheckedChanged += new System.EventHandler(this.ckAll_CheckedChanged);
//
// tbSubject
//
this.tbSubject.Location = new System.Drawing.Point(0, 12);
this.tbSubject.MaxLength = 500;
this.tbSubject.Name = "tbSubject";
this.tbSubject.Size = new System.Drawing.Size(755, 20);
this.tbSubject.TabIndex = 5;
//
// QuickNotificationCompose
//
this.AcceptButton = this.btnSend;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(755, 496);
this.Controls.Add(this.tbSubject);
this.Controls.Add(this.ckAll);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnSend);
this.Controls.Add(this.grid);
this.Controls.Add(this.tbMsg);
this.MinimizeBox = false;
this.Name = "QuickNotificationCompose";
this.ShowInTaskbar = false;
this.Text = "QuickNotification";
this.Load += new System.EventHandler(this.QuickNotificationCompose_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.QuickNotificationCompose_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox tbMsg;
private System.Windows.Forms.DataGridView grid;
private System.Windows.Forms.Button btnSend;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox ckAll;
private System.Windows.Forms.TextBox tbSubject;
}
}

View File

@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AyaNova.Plugin.QuickNotification
{
public partial class QuickNotificationCompose : Form
{
private QuickNotification mqn;
public QuickNotificationCompose(QuickNotification QN)
{
mqn = QN;
InitializeComponent();
this.btnSend.Image = (System.Drawing.Image)mqn.AyaNovaResourceManager.GetObject("OK24");
this.btnCancel.Image = (System.Drawing.Image)mqn.AyaNovaResourceManager.GetObject("Cancel24");
}
private void QuickNotificationCompose_Load(object sender, EventArgs e)
{
ckAll.Focus();
Win32Utility.SetCueText(tbSubject, "Subject");
Win32Utility.SetCueText(tbMsg, "Message");
this.Icon = Resource.QuickNotification ;
grid.DataSource=mqn.NotifyList;
grid.Columns["Category"].ReadOnly = true;
grid.Columns["Source"].ReadOnly = true;
grid.Columns["UserName"].ReadOnly = true;
//iterate rows, users not subscribed get red
int x=0;
foreach (NotifyItem ni in mqn.NotifyList)
{
DataGridViewRow row = grid.Rows[x];
if (!mqn.Subscribers.Contains(ni.UserID))
{
row.ReadOnly = true;
foreach (DataGridViewCell c in row.Cells)
{
c.Style.Font = new Font(grid.DefaultCellStyle.Font, FontStyle.Strikeout);
//c.Style.BackColor = System.Drawing.Color.WhiteSmoke;
//c.Style.ForeColor = System.Drawing.Color.Gray;
c.ToolTipText = ni.UserName + " is not subscribed to QuickNotification event";
}
}
x++;
}
Application.Idle += new EventHandler(Application_Idle);
}
private void QuickNotificationCompose_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Idle -= new EventHandler(Application_Idle);
}
private void Application_Idle(object sender, EventArgs e)
{
btnSend.Enabled = (mqn.HasSelectedUsers && HasSomethingToSend);
}
bool bIgnoreCheckChange = false;
private void grid_CurrentCellDirtyStateChanged(object sender, EventArgs e)
{
if (grid.IsCurrentCellDirty)
{
grid.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
}
private void grid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (!bIgnoreCheckChange && grid.Columns[e.ColumnIndex].Name == "Send")
{
DataGridViewCheckBoxCell checkCell =
(DataGridViewCheckBoxCell)grid.
Rows[e.RowIndex].Cells["Send"];
bool bWasChecked = !(Boolean)checkCell.Value;
Guid SelectedUserID=mqn.NotifyList[e.RowIndex].UserID;
bIgnoreCheckChange = true;
mqn.CheckAllForUser(!bWasChecked, SelectedUserID);
bIgnoreCheckChange = false;
grid.Invalidate();
}
}
public string MesageToSend
{
get
{
//case 1375
if (!string.IsNullOrEmpty(tbSubject.Text))
{
return "<SUBJECT>" + tbSubject.Text.Trim() + "</SUBJECT>" + tbMsg.Text.Trim().TrimEnd('\r','\n');
}
else
return tbMsg.Text;
}
}
//case 1375
public bool HasSomethingToSend
{
get
{//can send on either a subject or message alone
return ((!string.IsNullOrEmpty(tbSubject.Text)) || (!string.IsNullOrEmpty(tbMsg.Text)));
}
}
private void btnSend_Click(object sender, EventArgs e)
{
}
private void grid_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (grid.Columns[e.ColumnIndex].Name == "Send")
{
//check uncheck all based on first column
ckAll.Checked = !ckAll.Checked;
}
}
private void ckAll_CheckedChanged(object sender, EventArgs e)
{
mqn.CheckAll(ckAll.Checked);
grid.Invalidate();
}
private void grid_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (grid.Rows[e.RowIndex].ReadOnly)
{
MessageBox.Show(grid.Rows[e.RowIndex].Cells["UserName"].FormattedValue.ToString() + " is not subscribed to QuickNotification event");
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,84 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AyaNova.Plugin.QuickNotification {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AyaNova.Plugin.QuickNotification.Resource", typeof(Resource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Icon QuickNotification {
get {
object obj = ResourceManager.GetObject("QuickNotification", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
internal static System.Drawing.Bitmap QuickNotification16 {
get {
object obj = ResourceManager.GetObject("QuickNotification16", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap QuickNotification32 {
get {
object obj = ResourceManager.GetObject("QuickNotification32", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="QuickNotification" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\QuickNotification.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="QuickNotification16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\QuickNotification16.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="QuickNotification32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\QuickNotification32.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

View File

@@ -0,0 +1,89 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Text;
namespace AyaNova.Plugin.QuickNotification
{
public static class Win32Utility
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SendMessage(IntPtr hWnd, int msg,
int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
[DllImport("user32.dll")]
private static extern bool SendMessage(IntPtr hwnd, int msg, int wParam, StringBuilder lParam);
[DllImport("user32.dll")]
private static extern bool GetComboBoxInfo(IntPtr hwnd, ref COMBOBOXINFO pcbi);
[StructLayout(LayoutKind.Sequential)]
private struct COMBOBOXINFO
{
public int cbSize;
public RECT rcItem;
public RECT rcButton;
public IntPtr stateButton;
public IntPtr hwndCombo;
public IntPtr hwndItem;
public IntPtr hwndList;
}
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
private const int EM_SETCUEBANNER = 0x1501;
private const int EM_GETCUEBANNER = 0x1502;
public static void SetCueText(Control control, string text)
{
if (control is ComboBox)
{
COMBOBOXINFO info = GetComboBoxInfo(control);
SendMessage(info.hwndItem, EM_SETCUEBANNER, 0, text);
}
else
{
SendMessage(control.Handle, EM_SETCUEBANNER, 0, text);
}
}
private static COMBOBOXINFO GetComboBoxInfo(Control control)
{
COMBOBOXINFO info = new COMBOBOXINFO();
//a combobox is made up of three controls, a button, a list and textbox;
//we want the textbox
info.cbSize = Marshal.SizeOf(info);
GetComboBoxInfo(control.Handle, ref info);
return info;
}
public static string GetCueText(Control control)
{
StringBuilder builder = new StringBuilder();
if (control is ComboBox)
{
COMBOBOXINFO info = new COMBOBOXINFO();
//a combobox is made up of two controls, a list and textbox;
//we want the textbox
info.cbSize = Marshal.SizeOf(info);
GetComboBoxInfo(control.Handle, ref info);
SendMessage(info.hwndItem, EM_GETCUEBANNER, 0, builder);
}
else
{
SendMessage(control.Handle, EM_GETCUEBANNER, 0, builder);
}
return builder.ToString();
}
}
}