Toggling TopMost in VB.NET - vb.net

I have a form that has to be on top for a period of time, and then can be set behind other windows normally. Is there anything in addition to setting Me.TopMost to True or False that needs to be done? I ask because it doesn't seem to be working.

It should present no problem. The following code (C#, sorry for that, no VB.NET environment available where I am right now) sets TopMost to true, waits for 5 seconds and then toggles TopMost back to false.
private void MakeMeTopmostForAWhile()
{
this.TopMost = true;
ThreadPool.QueueUserWorkItem(state =>
{
Thread.Sleep(5000);
this.Invoke((Action)delegate { this.TopMost = false; });
});
}
Note that this does not affect the Z-order of the window immediately; when TopMost is set to false, the window will still be on top of other windows. If the window is on top of another window that is also topmost, it will move so that the other topmost window is not covered, but it will remain on top of other non-topmost windows.
Update
Here is the above code in VB.NET (auto-converted, not tested):
Private Sub MakeMeTopmostForAWhile()
    Me.TopMost = True
    ThreadPool.QueueUserWorkItem(Function(state) Do
        Thread.Sleep(5000)
        Me.Invoke(DirectCast(Function() Do
            Me.TopMost = False
        End Function, Action))
    End Function)
End Sub

Related

Saving position and locations drag item by jQuery ui sortable

I'm trying to make a sortable drag item where I click the save changes button that will save the layout. The sortable is working correctly, but the saving and loading aren't working properly. When I refresh, everything goes back to the original my second point is that when I drag an item that position save in local storage and then refresh the page item gets in the previous position. I'm hoping someone can help me out here.
URL
           
'jquery.skedTape.min.js', jquery.skedTape.css   ,jquery.skedTape.min.css                              
'jquery.skedTape.js',
'bootstrap-popover-x.min.js',
https://github.com/HifsaAnsari/dragdrop

Shopify: How to return only children of specified menu/linklist?

Let's assume we have a menu:
Main Menu
  └ Home
  └ About Us
    └ Locations
      └ Montreal
      └ Ottawa
I would like to return links only nested below "Locations" from our "Main Menu".
Expected Output:
- Montreal
- Ottawa
Is this possible?
Yes, it is possible only.You can just follow the below instructions and do it yourself.
Open your admin panel and open the Navigation part.
If you don't aware of Navigation means paste the below URL to change main menu
https://your-domain-name.myshopify.com/admin/menus
Note: You must replace your-domain-name
Here you can view the Menu list, For your understanding, I have attached the screenshot.
After click the Main menu it will redirects to another page.
In that page you can able to delete or add the list items.
If you have any query means, kindly ask again.

How restart the animation in UWP using Visible property?

In a UWP app, I show an error bar in the bottom of the Window, like Mail app of Windows 10. The idea is when I change the Visibility to Collapsed, the animation would start.
The animation only works once, when the window is created. I would like to trigger the animation each time that Visibility changes from Visible to Collapsed. The XAML code is:
<StackPanel Grid.Row="1" Canvas.ZIndex="10" Background="{StaticResource BackError}" VerticalAlignment="Bottom" Name="NotificationStackPanel" >
<StackPanel.Transitions>
<TransitionCollection>
<PaneThemeTransition Edge="Bottom"/>
</TransitionCollection>
</StackPanel.Transitions>
<TextBlock VerticalAlignment="Center" Foreground="White" Margin="20" Name="NotificationText"/>
</StackPanel>
My workaround for now is removing the entire StackPanel and recreating it again, it works but it seems too ugly.
PaneThemeTransition is a transition animation. Usually we use panel animations (PaneThemeTransition) to show UI that slides a significant distance into the screen, such as a task pane or a custom soft keyboard.
Transition animations have built-in triggers (the transition) that can run automatically when UI elements are added, removed, reordered, and so on. Transition animations are simple to apply. But we do not have much control over the timing and order of the animation effects. 
To restart the panel animation, you can remove the StackPanel form its parent element and then add it again like:
private bool isVisible = true;
private void ChangeVisibility()
{
    if (isVisible)
    {
        //Root is a Grid which is the parent element of NotificationStackPanel
        Root.Children.Remove(NotificationStackPanel);
    }
    else
    {
        Root.Children.Add(NotificationStackPanel);
    }
    isVisible = !isVisible;
}

Correcting Image Orientation server side in vb.net

In a mobile web application I am developing, users are allowed to take a picture with their camera and the camera image is uploaded to a server. The issue I am having is that on iOS devices, images get an EXIF Orientation tag associated with them such as "ROTATE 90 CW". This orientation tag causes the image to be displayed in an incorrect orientation when it is displayed. For example, if the user takes a picture of something with their iPhone in portrait orientation, the image appears to be rotated to landscape when viewed on the server. I want to correct this issue on the server-side using VB.Net so that I automatically detect the EXIF Orientation tag and if it is "ROTATE 90 CW" (or any other value that will make the image appear to be displayed incorrectly), then I want to automatically rotate the image to the correct orientation. In summary, I want the image on the server to appear exactly as it appeared when the user took the picture with their camera.
Can someone post the code that will do this? Thanks in advance.
For anyone who needs this, I basically resolved the issue using this code in VB.Net. I found this to be just what I needed:
Public Function TestRotate(sImageFilePath As String) As Boolean
Dim rft As RotateFlipType = RotateFlipType.RotateNoneFlipNone
Dim img As Bitmap = Image.FromFile(sImageFilePath)
Dim properties As PropertyItem() = img.PropertyItems
Dim bReturn As Boolean = False
For Each p As PropertyItem In properties
If p.Id = 274 Then
Dim orientation As Short = BitConverter.ToInt16(p.Value, 0)
Select Case orientation
Case 1
rft = RotateFlipType.RotateNoneFlipNone
Case 3
rft = RotateFlipType.Rotate180FlipNone
Case 6
rft = RotateFlipType.Rotate90FlipNone
Case 8
rft = RotateFlipType.Rotate270FlipNone
End Select
End If
Next
If rft <> RotateFlipType.RotateNoneFlipNone Then
img.RotateFlip(rft)
System.IO.File.Delete(sImageFilePath)
img.Save(sImageFilePath, System.Drawing.Imaging.ImageFormat.Jpeg)
bReturn = True
End If
Return bReturn
End Function
For anyone interested... C# version.
public static bool TestRotate(string filePath)
{
var rft = RotateFlipType.RotateNoneFlipNone;
var img = Image.FromFile(filePath);
var properties = img.PropertyItems;
var value = false;
foreach (var prop in properties.Where(i => i.Id == 274))
{
var orientation = BitConverter.ToInt16(prop.Value, 0);
rft = orientation == 1 ? RotateFlipType.RotateNoneFlipNone :
orientation == 3 ? RotateFlipType.Rotate180FlipNone :
orientation == 6 ? RotateFlipType.Rotate90FlipNone :
orientation == 8 ? RotateFlipType.Rotate270FlipNone :
RotateFlipType.RotateNoneFlipNone;
}
if (rft != RotateFlipType.RotateNoneFlipNone)
{
img.RotateFlip(rft);
File.Delete(filePath);
img.Save(filePath, ImageFormat.Jpeg);
value = true;
}
return value;
}

How would I animate a BlurEffect to any control?

I would like a reusable function that simply does a BlurEffect on any particular valid Control type.
e.g.
var animation = new DoubleAnimation
{
From = 0,
To = 8,
Duration = new TimeSpan(0, 0, 0, 2),
AutoReverse = true
};
control.Effect = new BlurEffect();
// How to cycle the From and To on the Blur Radius?
I am uncertain how to dynamically create an animation in code behind to make this possible.
This article shows how to define an animation and story board in code.
You'd need to add the BlurEffect and use RadiusProperty of blureffect instead of RotateTransform.AngleProperty like this:
control.Effect.BeginAnimation(Blureffect.RadiusProperty, animation);
-edit-
I see now that you're using Silverlight, not wpf (where Effect implements IAnimatable)
i'll try and find a solution for silverlight
-edit2-
Have you seen/tried this? Msdn also has a sample for silverlight
-edit3-
Your direction got me towards the right answer which is as follows:
private void BlurSomething(FrameworkElement control)
{
var storyboard = new Storyboard();
var animation = new DoubleAnimation
{
From = 0,
To = 8,
Duration = new TimeSpan(0, 0, 0, 1, 0),
AutoReverse = true
};
var effect = new BlurEffect();
control.Effect = effect;
storyboard.Children.Add(animation);
Storyboard.SetTarget(storyboard, control.Effect);
Storyboard.SetTargetProperty(storyboard, new PropertyPath("Radius"));
storyboard.Begin();
}
It should be noted that Silverlight does not make animations as easy as WPF, but in the end this can be done.