2016-05-31 16:58:06 -07:00
/ *
Copyright ( c ) 2016 , Greg Diaz
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
1. Redistributions of source code must retain the above copyright notice , this
list of conditions and the following disclaimer .
2. Redistributions in binary form must reproduce the above copyright notice ,
this list of conditions and the following disclaimer in the documentation
and / or other materials provided with the distribution .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES
( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ;
LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies ,
either expressed or implied , of the FreeBSD Project .
* /
2017-08-23 23:59:45 -07:00
using System.Linq ;
2016-05-31 16:58:06 -07:00
using MatterHackers.Agg.UI ;
2016-06-21 18:55:34 -07:00
using MatterHackers.Localizations ;
2017-08-23 23:59:45 -07:00
using MatterHackers.MatterControl.CustomWidgets ;
2016-07-28 16:36:47 -07:00
using MatterHackers.MatterControl.SlicerConfiguration ;
2016-05-31 16:58:06 -07:00
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
2017-08-23 23:54:31 -07:00
public class ShowAuthPanel : WizardPage
2016-05-31 16:58:06 -07:00
{
2016-06-07 15:45:50 -07:00
public ShowAuthPanel ( )
2017-08-23 17:27:30 -07:00
: base ( "Skip" )
2016-05-31 16:58:06 -07:00
{
2016-08-29 17:13:45 -07:00
WrappedTextWidget userSignInPromptLabel = new WrappedTextWidget ( "Sign in to access your cloud printer profiles.\n\nOnce signed in you will be able to access:" . Localize ( ) )
2016-05-31 16:58:06 -07:00
{
TextColor = ActiveTheme . Instance . PrimaryTextColor ,
} ;
2016-08-29 17:13:45 -07:00
contentRow . AddChild ( userSignInPromptLabel ) ;
2016-05-31 16:58:06 -07:00
2016-06-21 18:55:34 -07:00
AddBulletPointAndDescription ( contentRow ,
"Cloud Library" . Localize ( ) ,
"Save your designs to the cloud and access them from anywhere in the world. You can also share them any time with with anyone you want." . Localize ( ) ) ;
AddBulletPointAndDescription ( contentRow ,
2016-07-08 16:28:58 -07:00
"Cloud Printer Profiles" . Localize ( ) ,
2016-06-21 18:55:34 -07:00
"Create your machine settings once, and have them available anywhere you want to print. All your changes appear on all your devices." . Localize ( ) ) ;
AddBulletPointAndDescription ( contentRow ,
"Remote Monitoring" . Localize ( ) ,
"Check on your prints from anywhere. With cloud monitoring, you have access to your printer no matter where you go." . Localize ( ) ) ;
2016-08-29 22:04:09 -07:00
contentRow . AddChild ( new VerticalSpacer ( ) ) ;
2016-09-02 16:26:56 -07:00
CheckBox rememberChoice = new CheckBox ( "Don't remind me again" . Localize ( ) , ActiveTheme . Instance . PrimaryTextColor ) ;
2016-08-29 22:04:09 -07:00
contentRow . AddChild ( rememberChoice ) ;
rememberChoice . CheckedStateChanged + = ( s , e ) = >
{
2016-08-30 10:30:55 -07:00
ApplicationSettings . Instance . set ( ApplicationSettingsKey . SuppressAuthPanel , rememberChoice . Checked . ToString ( ) ) ;
2016-08-29 22:04:09 -07:00
} ;
2017-08-23 17:27:30 -07:00
this . cancelButton . Name = "Connection Wizard Skip Sign In Button" ;
this . cancelButton . Click + = ( s , e ) = >
2016-05-31 16:58:06 -07:00
{
2016-07-28 16:36:47 -07:00
if ( ! ProfileManager . Instance . ActiveProfiles . Any ( ) )
{
2017-08-23 17:27:30 -07:00
abortCancel = true ;
2017-08-23 15:51:29 -07:00
UiThread . RunOnIdle ( ( ) = >
{
WizardWindow . ChangeToPage < SetupStepMakeModelName > ( ) ;
} ) ;
2016-07-28 16:36:47 -07:00
}
2016-05-31 16:58:06 -07:00
} ;
2016-11-01 15:32:27 -07:00
2016-07-14 11:29:46 -07:00
var createAccountButton = textImageButtonFactory . Generate ( "Create Account" . Localize ( ) ) ;
createAccountButton . Name = "Create Account From Connection Wizard Button" ;
createAccountButton . Margin = new Agg . BorderDouble ( right : 5 ) ;
createAccountButton . Click + = ( s , e ) = >
{
2016-11-01 15:32:27 -07:00
UiThread . RunOnIdle ( ( ) = >
{
WizardWindow . Close ( ) ;
WizardWindow . ChangeToAccountCreate ( ) ;
} ) ;
2016-07-14 11:29:46 -07:00
} ;
2016-05-31 16:58:06 -07:00
2016-06-21 18:55:34 -07:00
var signInButton = textImageButtonFactory . Generate ( "Sign In" . Localize ( ) ) ;
2016-05-31 16:58:06 -07:00
signInButton . Name = "Sign In From Connection Wizard Button" ;
signInButton . Click + = ( s , e ) = >
2016-07-29 16:44:00 -07:00
{
2016-11-01 15:32:27 -07:00
UiThread . RunOnIdle ( ( ) = >
{
WizardWindow . Close ( ) ;
WizardWindow . ShowAuthDialog ? . Invoke ( ) ;
} ) ;
2016-05-31 16:58:06 -07:00
} ;
2017-08-23 17:27:30 -07:00
this . AddPageAction ( createAccountButton ) ;
this . AddPageAction ( signInButton ) ;
2016-05-31 16:58:06 -07:00
}
2016-06-21 18:55:34 -07:00
private void AddBulletPointAndDescription ( FlowLayoutWidget contentRow , string v1 , string v2 )
{
contentRow . AddChild ( new TextWidget ( "• " + v1 )
{
2017-08-07 15:47:27 -07:00
HAnchor = HAnchor . Left ,
2016-06-21 18:55:34 -07:00
TextColor = ActiveTheme . Instance . PrimaryTextColor ,
Margin = new Agg . BorderDouble ( 0 , 0 , 0 , 10 ) ,
} ) ;
2016-07-27 17:17:33 -07:00
contentRow . AddChild ( new WrappedTextWidget ( v2 )
2016-06-21 18:55:34 -07:00
{
TextColor = ActiveTheme . Instance . SecondaryTextColor ,
Margin = new Agg . BorderDouble ( 20 , 5 , 5 , 5 ) ,
} ) ;
}
2016-05-31 16:58:06 -07:00
}
}