Category Archives: StackOverFlow

Stack Overflow is a question and answer site for professional and enthusiast programmers.

Windows 10 TileText property behaving super weird

So I’ve been working on a Win10 Universal App and wanted to create some live tiles for it. I’m using the NotificationExtensions library for achieving this. However, I ran into a super weird behavior which doesn’t make any sort of sense to me. Basically, I’m trying to assign some string to the Text property of a TileText and it wouldn’t work in certain conditions. Let me exemplify a bit:

public abstract class TileLayoutBase
{
    public virtual TileText TileHeader => new TileText
    {
        Style = TileTextStyle.Caption,
        Align = TileTextAlign.Left,
        MaxLines = 1
    };

    public virtual TileText TileStaticText => new TileText
    {
        Style = TileTextStyle.CaptionSubtle,
        Align = TileTextAlign.Center,
        MaxLines = 1
    };

    public virtual TileText TileData => new TileText
    {
        Style = TileTextStyle.Body,
        Align = TileTextAlign.Center,
        MaxLines = 1
    };

    public virtual TileImage TileIcon => new TileImage
    {
        Align = TileImageAlign.Left,
        RemoveMargin = true,
        Source = new TileImageSource("some_image_source")
    };

    protected virtual TileBinding CreateSmallTileBinding()
    {
        TileGroup tileGroup = new TileGroup();
        TileSubgroup tileSubGroup = new TileSubgroup { TextStacking = TileTextStacking.Center };
        ... // code to create a medium sized binding
    }

    protected virtual TileBinding CreateLargeTileBinding()
    {
        TileGroup tileGroup = new TileGroup();
        TileSubgroup tileSubGroup = new TileSubgroup { TextStacking = TileTextStacking.Center };
        ... // code to create a large tile binding
    }

    public abstract Task<TileNotification> UpdateTileAsync();
 }

public sealed class ConnectionRequestDetailsTile : TileLayoutBase
{
    private readonly ResourceLoader m_resLoader;

    public ConnectionRequestDetailsTile(int connectionRequestCount, ResourceLoader resLoader)
    {
        if (resLoader == null)
        {
            throw new ArgumentNullException(nameof(resLoader));
        }
        m_resLoader = resLoader;

        //TileHeader.Text = m_resLoader.GetString("Connections");
        //TileStaticText.Text = m_resLoader.GetString("Requests");
        //TileData.Text = connectionRequestCount.ToString();

        TileHeader.Text = "Connections";
        TileStaticText.Text = "Requests";
        TileData.Text = connectionRequestCount.ToString();
    }

    public override async Task<TileNotification> UpdateTileAsync()
    {
      ...
    }
   .....
 }

read more

Windows 10 TileText property behaving super weird

So I’ve been working on a Win10 Universal App and wanted to create some live tiles for it. I’m using the NotificationExtensions library for achieving this. However, I ran into a super weird behavior which doesn’t make any sort of sense to me. Basically, I’m trying to assign some string to the Text property of a TileText and it wouldn’t work in certain conditions. Let me exemplify a bit:

public abstract class TileLayoutBase
{
    public virtual TileText TileHeader => new TileText
    {
        Style = TileTextStyle.Caption,
        Align = TileTextAlign.Left,
        MaxLines = 1
    };

    public virtual TileText TileStaticText => new TileText
    {
        Style = TileTextStyle.CaptionSubtle,
        Align = TileTextAlign.Center,
        MaxLines = 1
    };

    public virtual TileText TileData => new TileText
    {
        Style = TileTextStyle.Body,
        Align = TileTextAlign.Center,
        MaxLines = 1
    };

    public virtual TileImage TileIcon => new TileImage
    {
        Align = TileImageAlign.Left,
        RemoveMargin = true,
        Source = new TileImageSource("some_image_source")
    };

    protected virtual TileBinding CreateSmallTileBinding()
    {
        TileGroup tileGroup = new TileGroup();
        TileSubgroup tileSubGroup = new TileSubgroup { TextStacking = TileTextStacking.Center };
        ... // code to create a medium sized binding
    }

    protected virtual TileBinding CreateLargeTileBinding()
    {
        TileGroup tileGroup = new TileGroup();
        TileSubgroup tileSubGroup = new TileSubgroup { TextStacking = TileTextStacking.Center };
        ... // code to create a large tile binding
    }

    public abstract Task<TileNotification> UpdateTileAsync();
 }

public sealed class ConnectionRequestDetailsTile : TileLayoutBase
{
    private readonly ResourceLoader m_resLoader;

    public ConnectionRequestDetailsTile(int connectionRequestCount, ResourceLoader resLoader)
    {
        if (resLoader == null)
        {
            throw new ArgumentNullException(nameof(resLoader));
        }
        m_resLoader = resLoader;

        //TileHeader.Text = m_resLoader.GetString("Connections");
        //TileStaticText.Text = m_resLoader.GetString("Requests");
        //TileData.Text = connectionRequestCount.ToString();

        TileHeader.Text = "Connections";
        TileStaticText.Text = "Requests";
        TileData.Text = connectionRequestCount.ToString();
    }

    public override async Task<TileNotification> UpdateTileAsync()
    {
      ...
    }
   .....
 }

read more

Move another ViewController from different storyboard in swift

In objective-C, to move another viewcontroller from different storyboard, we will use following coding to fulfil what we want.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Customer" bundle:nil];
HomeSummaryViewController *creaccVC = [storyboard instantiateViewControllerWithIdentifier:@"HomeSummaryViewController"];
[self.navigationController pushViewController:creaccVC animated:YES];

In swift version, please help me to how to do just like Objective-C?

Move another ViewController from different storyboard in swift

read more