|
|
I would probably try to explain customer that the problem is not in my application but in operating system. If I was creating a protocol that does not work on an operating system, I would have explored further to fix it. But here it appears you are creating an application which has some pre-requisites which are outside or your control and must be provided by consumer of your application.
I would stay away from try to fix this as soon someone would show up with a XP based computer and now I need to support that as well.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
Hello everybody,
If i used ClickOne, where could i say the path the program has to be installed in the user pc?
|
|
|
|
|
ClickOnce apps are installed per-user, meaning every user on a machine has their own copy of the app in their user profile under C:\Users\userId\AppData\Local\Apps\2.0. Each app has it's own folder and another folder assigned to it under the Data folder.
|
|
|
|
|
Thanks a lot, than mean that i can not change the pre-defined folder:
C:\Users\userId\AppData\Local\Apps\2.0. ?
|
|
|
|
|
No, you can't.
If you're looking for something more akin to a normal .MSI installer, you're going to have to use a 3rd party packaging tool, like Wix, InnoSetup, Advanced Installer, InstallShield, or the like to package up your app.
|
|
|
|
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class moviment1 : MonoBehaviour
{
public float Speed;
public float JumpForce;
public bool isJumping;
public bool doubleJump;
private Rigidbody2D rig;
void Start()
{
rig = GetComponent<Rigidbody2D>();
}
void Update()
{
Move();
Jump();
}
void Move()
{
Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0.0f, 0.0f);
transform.position += movement * Time.deltaTime * Speed;
}
void Jump()
{
if (Input.GetButtonDown("Jump") )
{
if(!isJumping)
{
rig.AddForce(new Vector2(0.0f, JumpForce), ForceMode2D,Impulse);
doubleJump = true;
}
else
{
if(doubleJump)
{
rig.AddForce(new Vector2(0.0f, JumpForce), ForceMode2D,Impulse);
doubleJump = false;
}
}
}
}
void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.layer == 8)
{
isJumping = false;
}
}
void OnCollisionExit2D(Collision2D collision)
{
if(collision.gameObject.layer == 8)
{
isJumping = true;
}
}
|
|
|
|
|
If that's how your code is really formatted, it's no wonder you're getting this error.
It means you have mismatched { and } characters in your code.
Clean up the formatting, making sure matching { and } line up and are indented properly and you'll find the problem.
The error says you're missing a closing brace at the end of the code snippet you posted.
|
|
|
|
|
Hi Joana,
You need one more } to close the class. Add it to the end of your class.
See Sample below:-
//==================================================================================
public class moviment1 : MonoBehaviour
{
public float Speed;
public float JumpForce;
public bool isJumping;
public bool doubleJump;
private Rigidbody2D rig;
// Start is called before the first frame update
void Start()
{
rig = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
Move();
Jump();
}
// MOVE
void Move()
{
Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0.0f, 0.0f);
transform.position += movement * Time.deltaTime * Speed;
}
// JUMP
void Jump()
{
if (Input.GetButtonDown("Jump"))
{
if (!isJumping)
{
rig.AddForce(new Vector2(0.0f, JumpForce), ForceMode2D, Impulse);
doubleJump = true;
}
else
{
if (doubleJump)
{
rig.AddForce(new Vector2(0.0f, JumpForce), ForceMode2D, Impulse);
doubleJump = false;
}
}
}
}
void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.layer == 8)
{
isJumping = false;
}
}
void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.layer == 8)
{
isJumping = true;
}
}
}
|
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?
That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You have already posted this in QA:
Windows devices humaninterfacedevice[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good afternoon,
Where can I find a tutorial that will help me understand how to capture when a user presses the "X" in the upper right corner of the form? Right now everything is working fine, but when they press the "X" in a child form, it doesnt return to the parent form or in the case of the main form, exit the application.
So, something to show me how to capture when that "X" is clicked.
Richard
Disable Vet
Grandfather
Pain in the @ss
|
|
|
|
|
|
Select the Form in the Designer window, and click on the FormClosing event in the properties window. The event will be fired when the user clicks the X button.
|
|
|
|
|
If that exe is not running on machine then need to run the windows form exe from Windows Service,
|
|
|
|
|
You can't. That's the whole point of a Service: it has no interaction at all with the user, and will run even when a user is not logged in. Services run in an isolated session that is absolutely prohibited from any interaction with the user, desktop, display, keyboard, mouse, or any other HMI device.
So it can't start an app that has any interaction with the user because it has no idea what user that might be, or even that there is a keyboard and display attached to the computer ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You can use Task Scheduler to start a Windows App at a given interval if it hasn't already been started (single instance option).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
My question is in the code comment below:
public class MyBase
{
public string CommonProperty { get; set; }
}
public class ClassOne : MyBase
{
public string ClassOneProperty { get; set; }
}
public class ClassTwo : MyBase
{
public string ClassTwoProperty { get; set; }
}
public class program()
{
var classTwo = new ClassTwo();
classTwo.CommonProperty = "Some string";
classTwo.ClassTwoProperty = "Some other string";
TestFunction(classTwo);
private void TestFunction(object unknownClass)
{
}
}
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
You could use the 'as' operator to try and cast it to a known type, if the cast works then you know the object type.
private static void TestFunction(object unknownClass)
{
ClassOne c1 = unknownClass as ClassOne;
if (c1 != null)
{
Console.WriteLine("Object is a ClassOne object");
}
else
{
Console.WriteLine("Object is not a ClassOne object");
}
ClassTwo c2 = unknownClass as ClassTwo;
if (c2 != null)
{
Console.WriteLine("Object is a ClassTwo object");
}
else
{
Console.WriteLine("Object is not a ClassTwo object");
}
}
|
|
|
|
|
Thank you, Tony. I'm trying to avoid duplicating code that accesses the properties common to all the objects passed to TestFunction. If you have a moment, please see my clarification in this thread.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
GetType() will return the object name
static void TestFunction(object unknownClass)
{
string sType = unknownClass.GetType().ToString();
Console.WriteLine(sType);
Console.ReadLine();
}
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Thank you, Mycroft. I did know about getting the name and type, but that only gets me part way there. I'm trying to avoid duplicating code that accesses the properties common to all the objects passed to TestFunction. If you have a moment, please see my clarification in this thread.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
What I'm trying to do is avoid duplicating code to access/manipulate the common properties. In TestFunction I want to be able to take unknownObject, cast it to its actual class type, and display or change its properties. Something like the following (which won't build):
private void TestFunction(object unknownClass)
{
var localObject = null;
string specificProperty = string.empty;
switch (unknownObject.GetType().Name)
{
case "ClassOne":
localObject = (ClassOne)unknownObject;
specificProperty = object.ClassOneProperty;
break;
case "ClassTwo":
localObject = (ClassTwo)unknownObject;
specificProperty = object.ClassTwoProperty;
break;
}
Console.PrintLine($"Common Property = {localObject.CommonProperty}, Specific Property = {specificProperty}.");
}
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
But you are not changing the common property in your example (except it may be because it is an example).
Once you have the type I think there is something like
String s = (unknownobject As ClassOne).CommonProperty
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|