Posts

Xamarin Forms toaster notification for android and iOS

A simple solution is by using the Dependency Service you can easily get the Toast notification in both Android and iOS.   Create an interface in your Xamarin forms package. public interface IMessage { void LongAlert ( string message ) ; void ShortAlert ( string message ) ; }   Android Project   [ assembly: Xamarin.Forms.Dependency(typeof(MessageAndroid)) ] namespace Your.Namespace { public class MessageAndroid : IMessage { public void LongAlert ( string message ) { Toast.MakeText(Application.Context, message, ToastLength.Long).Show(); } public void ShortAlert ( string message ) { Toast.MakeText(Application.Context, message, ToastLength.Short).Show(); } } }    iOS Project   [ assembly: Xamarin.Forms.Dependency(typeof(MessageIOS)) ] namespace Your.Namespace { public class MessageIOS : IMessage { const double LONG_DELAY = 3.5 ; const double SH
HOW TO RESOLVE REPORTING SERVICES CATALOG DATABASE FILE EXISTENCE FAILED OR TEMPORARY DATABASE FILE EXISTENCE FAILED Next to go to the Sql server root directory, by default C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA Files to be deleted ReportServer.mdf ReportServer_log.LDF ReportServerTempDB.mdf ReportServerTempDB_log.LDF .

Calling a Web Service from T-SQL

First you need grand  permission Ole Automation Procedures to your server. This can be achived by executing the below sql script sp_configure 'show advanced options', 1  RECONFIGURE; sp_configure 'Ole Automation Procedures', 1  RECONFIGURE;  sp_configure 'show advanced options', 1 RECONFIGURE;  Then the next step is to call a web call. create FUNCTION dbo.WebRequest(@parm VARCHAR(20)) RETURNS VARCHAR(250) AS BEGIN  DECLARE @parmVARCHAR(20)  SET @parm= @parm Declare @Object as Int; Declare @ResponseText as Varchar(8000); Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; Exec sp_OAMethod @Object, 'open', NULL, 'get', http://www.your.api.call.here', --Your Web Service Url (invoked) 'false' Exec sp_OAMethod @Object, 'send' Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT --Select @ResponseText Exec sp_OADestroy @Object     RETURN @ResponseText END replace the http://www.your.api.call.

Email Providers

Step 1: Get the NuGet  package    Click here... Step 2 :             string userName = "userName ";             string password = "password ";             var data = SmtpConfig.ForSendGrid(userName, password);             SmtpEmailProvider obj = new SmtpEmailProvider(data);             var email = new Email()             {                 ReceiverName = "ReceiverName ",                 ToAddress = "ToAddress @domain.com",                 SenderName = "SenderName",                 FromAddress = "FromAddress @domain.com",                 Message = "Message ",                 Subject = "Subject ",                 IsHtmlEmail = false              };             var re = obj.Send(email); There are many Smtp setting available. ForGoDaddy ForGmail ForOutlook ForMailGun ForSendGrid Happy Coding... :)

NuGet - Common Security

Step 1: Get the NuGet package  https://www.nuget.org/packages/Common.Security/ Set the property with a string Security.CypherPassWord Security.CypherPassWord = "CypherPassWord"; Call the static method for  Security.Encrypt()  syntax :       Security.Encrypt(planeText,password) Call the static method for  Security.Decrypt()  syntax :       Security.Decrypt(planeText,password)

Method inside a Method in c# 7.0

A new feature was introduced in c# 7.0, in which we can call a local methods to be defines and call within a method. This feature was not in the previous versions. Which is like, defining the call back function just above the method in jquery. The blow is as sample code static void Main(string[] args)   {     void Display(string str)     {       Console.WriteLine(str);   }        Display("Hello world....")     Console.ReadKey();   } 

Remove icon from action bar for xamarin forms android project

Put the below code in xamarin.android (xamarin.droid) project. [assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))] namespace Example {     public class RootNavigationRenderer : NavigationRenderer     {         protected override void OnElementChanged(ElementChangedEventArgs e)         {             base.OnElementChanged(e);             RemoveAppIconFromActionBar();         }         void RemoveAppIconFromActionBar()         {             var actionBar = ((Activity)Context).ActionBar;             actionBar.SetIcon(new ColorDrawable(Color.Transparent.ToAndroid()));         }     } }