473,776 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Initialize not being called

I'm using the UIP App block and I have overridden the Initialize
method, but my override never gets called. Here's the code:

public override void Initialize(Task ArgumentsHolder args,
ViewSettings settings) {

base.Initialize (args, settings);

Logger.Write("I nitialize");

}

Any ideas?

Thanks,
Bryan
Nov 19 '05 #1
8 2003
Hi Bryan,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 19 '05 #2
Hi Bryan,

Welcome to MSDN newsgroup!

Based on my understanding, the current situation is you create a custom
class to implement the IView interface and use the custom class in the
project. Please let me know if I have misunderstood anything.

As far as I know, the Initialize method is called after the view manager
instantiates the view. So could you please help me to confirm some
information?

First, the category of the application is Winform or Web form;

Second, please supply the code snippet of calling the Initialize method;

Third, I suggest we set the breakpoint for the override function and debug
the project. Then we can confirm whether the Initialize method executes or
just add log failed.

I look forward to your reply.

Yuan Ren [MSFT]
Microsoft Online Support

Nov 19 '05 #3
On Mon, 19 Sep 2005 06:30:34 GMT, v-****@microsoft. com ("ÈÎÔ¶[΢Èí]")
wrote:

Yuan -
I create a class derived from WebFormView and override the
Initialize method:

public class ViewWelcome : WebFormView {
public override void Initialize(Task ArgumentsHolder
args, ViewSettings settings) {

base.Initialize (args, settings);

Logger.Write("I nitialize");

}
..
..
..
}

I never see the "Initialize " message in the log, and if I set a
breakpoint in this method it never gets hit.

I verified that the page does actually load by setting a breakpoint in
the Page_Load method.

Thanks for the help.
Bryan
Hi Bryan,

Welcome to MSDN newsgroup!

Based on my understanding, the current situation is you create a custom
class to implement the IView interface and use the custom class in the
project. Please let me know if I have misunderstood anything.

As far as I know, the Initialize method is called after the view manager
instantiates the view. So could you please help me to confirm some
information?

First, the category of the application is Winform or Web form;

Second, please supply the code snippet of calling the Initialize method;

Third, I suggest we set the breakpoint for the override function and debug
the project. Then we can confirm whether the Initialize method executes or
just add log failed.

I look forward to your reply.

Yuan Ren [MSFT]
Microsoft Online Support

Nov 19 '05 #4
Hi Bryan,

Thanks for your post!

After my researching, the reason of the Initialize method not executing is
that the architecture is different between Winform and Webform. In the
Webform application, switching form is implemented by call redirect method
in "Http.Context.R esponse". It means if we want to go to the new form, the
server side redirect to the new page directly. Below is the snippet for UIP
source code in "WebFormViewMan ager.cs file":
public void ActivateView( string previousView, Guid taskId, string
navGraph, string view )
{
RedirectToNextV iew(previousVie w, viewSettings);
}
the RedirectToNextV iew method:
private void RedirectToNextV iew(string previousView, ViewSettings
viewSettings)
{
try
{
if( previousView == null )
HttpContext.Cur rent.Response.R edirect(
HttpContext.Cur rent.Request.Ap plicationPath + "/" + viewSettings.Ty pe, true
);
else
HttpContext.Cur rent.Response.R edirect(
HttpContext.Cur rent.Request.Ap plicationPath + "/" + viewSettings.Ty pe ,
false );
}
catch(System.Th reading.ThreadA bortException) {}
}
Actually the Initialize method is never called in the Webform application.
And below is the snippet for UIP source code in "WindowsFormVie wManager.cs"
file:
public void ActivateView( string previousView, string view, Navigator
navigator, TaskArgumentsHo lder args )
{
¡*
if (winFormView != null)
{
winFormView.Act ivate();
¡*
}
else if(controlView != null)
{
ActivateControl (controlView, previousView);
¡*
}
viewSettings = CreateNewView(v iew, navigator, taskId, args);
ClosePreviousFo rmIfNecessary(n ull, previousView, taskId, viewSettings);
¡*
}
We can find the CreateNewView call the ActivateForm method. And in the
ActivateForm method, the Initialize executes directly.
So the reason for designing is the Webform application use Http pipeline to
communicate with each other but the Winform application can create the new
form directly. We can find the description about the Initialize method in
the documentation as below:
"Called after the view manager instantiates the view, but before calling
Show()."
(*The documentation you can download from below link:
http://www.microsoft.com/downloads/d...C9D-88E1-4490-
8BD6-78092A0F084E&di splaylang=en)
It means the method is used in the Winform application because there is no
the show method in the Webform application.
If your want to add the log for the Webform application. I suggest we add
the function into the "WebFormView_Lo ad" method or your custom load method.

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Thanks.

Yuan Ren [MSFT]
Microsoft Online Support

Nov 19 '05 #5
On Tue, 20 Sep 2005 06:20:21 GMT, v-****@microsoft. com ("Yuan
Ren[MSFT]") wrote:

Hi Yuan -

Thanks for the response. I figured it was something like that. My
reason for wanting to override the Initialize method is to be able to
use custom attributes in the <view> section of the config file, which
are passed to Initialize in the ViewSettings argument. (Each page has
some supplementary information and I thought the config file would be
a good place to store it.) Since Initialize is never being called, is
there an easy way to get access to this information?

Thanks again for all the help!

Bryan
Nov 19 '05 #6
Hi Bryan,

Thanks for your posting!

Based on my understanding, you require getting a custom attributed value
while the application is loading. Meaning you want to use a ViewSettings
argument such as ¡°ViewSettings. Type¡±. Please let me know if I have
misunderstood.

If we want to use the value in our custom class, I think reading the
setting from the config file directly is a better way. In the ¡
°WebFromViewMan ager.cs¡± file, the ¡°ActiveView¡± method is another method
for getting the value of settings, but different from the ¡
°WindowsFormVie wManager.cs¡± file. The WebForm Application doesn¡¯t supply
any method like ¡°Initialize¡±, so my suggestion is we read the value of
the setting from the config file by using a XML reader or have the UIP do
it. The reading method can be executed in our custom ¡°WebFormView_L oad¡±
method.

I hope the above information helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.

Yuan Ren [MSFT]
Microsoft Online Support

Nov 19 '05 #7
Hi Yuan -
I think you have understood my problem. I have several attributes
which I want to associate with individual views. Since it looks like
there is no easy way to have the UIAP block get these for me in a
WebFormView derived class, I'll just read them from the config file
myself as you suggested.

Thanks,
Bryan
Nov 19 '05 #8
Hi Bryan,

While, I'm glad to help you for the issue. If you have any issues or
concern, welcome to MSDN newsgroup. We'll discuss together.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3708
by: Mario S. | last post by:
Hi, how can I determine, if the XMLPlatformUtils::Initialize() was already called or not ? There is no static method XMLPlatformUtils::isInitialized(). Perhaps this would be a nice feature in the next Xerces Release ? For now, I have a little workaround. Because it is really necessary that a TransService is loaded and XMLPlatformUtils::fgTransService is in any case not NULL after Initialize() method was called, I use this behaviour and
1
4084
by: timtos | last post by:
I am using IShellExtInit.Initialize (Thanks to Mattias Sjögren) and it is called when I right-click a folder! Unfortunately it is called 3 times and not only once... For debugging purpose there is only one line in that Initialize function: return 0; How can something like that happen? Thanks a lot for help! Greetings, timtos.
3
1923
by: Danny Ni | last post by:
Hi, Is there a way to initialize an user control after it's loaded? I know this is a strange question, so allow me to elaborate, I have an user control which allow users to enter customer data and save them into SQL server. The user control has about 50 textboxes and other web controls. To simplify, let's say user control contains a textbox txtCompany and another textbox called txtContact, for the first company, I entered "ABC plumbing"...
0
917
by: Bryan | last post by:
I'm using the UIP App block and I have overridden the Initialize method, but my override never gets called. Here's the code: public override void Initialize(TaskArgumentsHolder args, ViewSettings settings) { base.Initialize (args, settings); Logger.Write("Initialize");
15
26436
by: thinktwice | last post by:
char a = { 0 } is it ok?
14
1646
by: 2005 | last post by:
If a Constructor can be used to initialize, when is memory is allocated / say the "new" operator etc? Thanks
1
4268
by: Vol | last post by:
Hi, Group, I want to initialize a 2D static array in function 'foo ()', where 'foo' is called by another function a lot of times. I list my implementation below but I think there are better solutions , thanks void foo() { int i, j;
6
9470
by: Ramon | last post by:
Is there a way to initialize the variables (or other data) of a header file by using a function (similar to main() function)?? Thankx
9
3418
by: Steven Woody | last post by:
Hi, Supposing a class get a complicated static member foo, and it need to be initialized before any method of the class can be called, where should I put these initialization code? I don't want to put them in main(), it's so far away. Thanks. -
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.