Skip to content

Instantly share code, notes, and snippets.

View Delaire's full-sized avatar

Damien Delaire Delaire

View GitHub Profile
/// <summary>
/// class for requesting lists.
/// </summary>
public class ListRequest : RequestBase
{
private string _callId;
public ListRequest(string callId)
{
_callId = callId;
@Delaire
Delaire / CoreTools.cs
Last active April 17, 2023 20:51
UWP, C# - Retrieve the redirect url using HttpClient from the Headers of the Response - [HttpClient,C#]
public static class CoreTools
{
public static async Task<string> GetRedirectedUrl(string url)
{
//this allows you to set the settings so that we can get the redirect url
var handler = new HttpClientHandler()
{
AllowAutoRedirect = false
};
string redirectedUrl = null;
@Delaire
Delaire / DeviceFamilyStateTrigger.cs
Last active March 3, 2016 22:53
This file is to be used with this gist: https://gist.github.com/Delaire/37cbe07738df34bfd5e8 you will be able to use an adaptive trigger depending on the device type, this code is base on @dotMorten code which can be found here: https://github.com/dotMorten/WindowsStateTriggers/blob/master/src/WindowsStateTriggers/DeviceFamilyStateTrigger.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
namespace Win10.StateTriggers
{
@Delaire
Delaire / StatusBarHelper.cs
Last active January 26, 2016 16:56
A StatusBarHelper on a Windows Universal application for Mobile, using Windows Mobile Extensions for the UWP reference
public static class StatusBarHelper
{
private static StatusBar statusBar
{
get
{
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
return StatusBar.GetForCurrentView();
}
@Delaire
Delaire / DeviceTypeHelper.cs
Last active January 25, 2016 00:21
How to find the device platform/type your Windows 10 application is running on
public static class DeviceTypeHelper
{
public static DeviceTypeEnum GetDeviceType()
{
switch (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily)
{
case "Windows.Desktop":
return DeviceTypeEnum.Tablet;
case "Windows.Mobile":
return DeviceTypeEnum.Phone;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Windows.ApplicationModel;
using Windows.System;
using Microsoft.VisualBasic;
namespace ShareLogic_Lib
//the object of this methode is to create 2 rectangles, from our two objects and see they intersect or not
protected bool IsObjectHidden(FrameworkElement child, FrameworkElement scrollViewer, int Offset)
{
//Getting the information related to the scrollViewer
GeneralTransform childTransform = child.TransformToVisual(scrollViewer);
//creating out first rectangle using the object that i wish to ttrack
Rect childRectangle = childTransform.TransformBounds(new Rect(new Point(0, 0), child.RenderSize));
//creating out second rectangle using the scrollViewer