I am using the Particle Setup SDK, where I call a method which requires me to assign a value to
public Frame AppFrame { get; set; }
However, I am unsure what value I am supposed to assign it.
AppFrame = //What value am I meant to assign to it, a window.xaml,
//that contains a method of type Frame?
I tried to assign it a Window with a method called public Frame particleframe() although it is giving me the error Cannot implicitly convert type 'System.Windows.Controls.Frame' to 'Windows.UI.Xaml.Controls.Frame'. So I tried to directly assign it the correct library:
public Windows.UI.Xaml.Controls.Frame particleframe()
Unfortunately this didn't work as type UI doesn''t exist. Can anyone point me in the right direction?
Related
I'm trying to build a Proof of Concept with nested components.
I have a main-component which is declared the following
public abstract class VoidHtmlComponent : ComponentBase
{
[Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }
}
and I pass an instance of e.g a TableHead to my Table component
<Shared.RazorComponents.Table TableHead="#(new TableHead{ OnClick = HandleTableHeadClick})" >
</Shared.RazorComponents.Table>
#code{
private void HandleTableHeadClick(MouseEventArgs mouseEventArgs)
{
Trace.WriteLine($"TableHead has been clicked ...");
}
}
This will not build stating
Client\Pages\Table.razor(6,213): Error CS0428: Cannot convert method group 'HandleTableHeadClick' to non-delegate type 'EventCallback'. Did you intend to invoke the method?
I guess blazor is doing some magic here to convert the Action<MouseEventArgs> to an EventCallback<MouseEventArgs> but I am stuck at this point. I also changed the parameter to Action<MouseEventArgs> which throws an error on runtime saying the cast is invalid.
Already tried using EventCallbackFactory but got stuck there as well.
Using OnClick = new EventCallbackFactory().Create(this, HandleTableHeadClick) throws
Function statements require a function name
at runtime.
I think the issue is that you create an instance of the TableHead just like a property.
Since we don't know anything about the Table component it self I just assume that the issue is is around there.
The markup for using Renderfragments for this case would like like something like this:
<Shared.RazorComponents.Table>
<TableHead Context="context">
<p>put what ever you want to render here. Like the nested component with event handler</p>
</TableHead>
</Shared.RazorComponents.Table>
See the docs as a reference.
I want to access a public class from my activity. I have a public class called HomePageActivity (It's using AppCompatActivity) which is that public class activity contains another class called Model.User CurrentUser (It's for calling current user since login by calling the userEmail on my database model property). HomePageActivity contains shared preference and I store all of the user data with variables such as current user, userID and email and I can call it from another class. In the next activity (UploadActivity), I want to access HomePageActivity and its attributes.
So, what I do :
Declare the HomePageActivity in my next activity which is in UploadActivity ==> public HomePageActivity m_currentActivity;
Call the m_currentActivity inside onCreate since I use Android.Support.V4.App.FragmentActivity ==> m_currentActivity = (HomePageActivity) this.Activity;
Try to call the m_currentActivity on my needed area ==> m_currentActivity.idUser;
But, I failed. I stuck. I can't cast HomePageActivity. Fortunately, I can use m_currentActivity = (HomePageActivity) this.Activity; on my Android.Support.V4.App.Fragment (on another fragment) but, why in UploadActivity which uses Android.Support.V4.App.FragmentActivity I can't cast my HomePageActivity
What happens if I don't use m_currentActivity = (HomePageActivity) this.Activity; ?
Well, based on my previous trial and error on my fragment and also on my UploadActivity, if I don't declare and cast the HomepageActivity, I can't get the value of the entities such as I can't get the value of m_currentActivity.idUser. If I debug, it will return null or crash like
object reference not set to an instance of an object
I've searched a lot of articles, but I still can't get my answer. I hope to hear the answer and recommendation from all of you. Thank in advance!
this.Activity is only available inside of the Fragments. If your UploadActivity inherits from Android.Support.V4.App.FragmentActivity you will not get this.Activity. If you are running any fragments inside the UploadActivity than inside those fragments you will get this.Activity of type UploadActivity.
If you some data to take with you to next activity use Intents. If you really want complete context of the last activity use a static property in the first activity and pass this in it. In you case create a static property in HomePageActivity and of type HomePageActivity and in OnCreate method pass this(current instance) in it. This property will be available through out the project. Make sure to use it if you absolutely have to.
Well, guys thank you for your response. Basically, I use intent and I access from my main class. Before it, I already put global variables in my main activity so, I can call them and access them from the main activity
I want to overwrite a read-only variable to simulate fingertouch with mouse in my code:
Touch fakeTouch = new Touch();
fakeTouch.position = Input.mousePosition;
The error I am getting is:
UnityEngine.Touch.position cannot be assigned to (it is read only).
How can I change it to public or so to overwrite it?
Here is what I want to do in the reply: Convert UnityEngine.Vector3 to UnityEngine.Touch or mouse input
In Unity 5.6, you cannot overwrite the position field in the Touch class, since it is used as a C++-compatible container structure and not intended to be created directly in the runtime.
Define a public sealed class TouchEx that contains the fields you need, and bypass the Touch object in your own code.
I'm really confused by now.
I've got a WinForm which holds a large Array
int[,] map = new int[1000, 1000];
I've also got a class containing a method "Draw".
The draw method now needs to get the value of a position in the array in the form. I tried doing the following thing:
In my Form class, I added
public int mapContentAtXY(Point mapPosition)
{
return map[mapPosition.X, mapPosition.Y];
}
Now if I try to perform
myInt = Ingame.mapContentAtXY(myPoint);
//Note: Ingame is the name of my Form
It says
Error 2 'Neu.Ingame' does not contain a definition for 'mapAtPositionXY'
This is really confusing, I just added that definition, it's also set as public. So why the hell doesn't it work?
You will need to pass the instance of the Form to the draw-class by using this when you create or call that instance of the draw-class. Then you can access that method through that form instance.
OR
Store the map not in the form, but in that draw-class. Move the mapContentAtXY method to the draw-class. Use the one instance of the draw-class in your form to update that map.
Your method mapContentAtXY is an instance method.
Change Ingame to this, if you're calling it from within your form instance.
myInt = this.mapContentAtXY(myPoint);
Otherwise use the form instance
myInt = frmInGameInstance.mapContentAtXY(myPoint);
I want to use an InArgument parameter in my Activity. I use an expressionTextBox to showing and using the InArgument value in XAML code. My problem is this I declare a variable and assign it to this expressiontextbox in Activity Library designer. When in the Execute() method of the activity, I change the value of InArgument parameter - I want the variable value to change too. How can I do it?
My code is like this...
...
public InArgument<string> AcceptedForms{ get; set; }
...
protected override void Execute(CodeActivityContext context)
{
...
string AForms= "#AcceptedForms_"+ this.Id;
AcceptedForms.Set(context, AForms);
...
}
I can use the value of AcceptedForms in this method after changing it's value. But it doesn't pass to the variable that I assign to it in Activity Library Designer. I want to use it's value in another Activity.
You won't be able to do that because when they are passed into the WF runtime I don't think they are passed by reference. So, what you'll have to do is setup an OutArgument that you set while in the Execute method and set that OutArgument -- in the workflow -- to the variable.
UPDATE
If you can take 15 minutes and watch this video I think you'll better understand what's going on. And BTW, below is the entire list of videos in this series, it's an amazing foundation on these types of things.
Part 1
Part 2
Part 3
Part 4
Part 5