Skip to content

Commit

Permalink
Merge pull request #210 from FutureAIGuru/FutureAISocietyIntro
Browse files Browse the repository at this point in the history
Future ai society intro
  • Loading branch information
FutureAIGuru authored Oct 17, 2023
2 parents 50e4cdf + 338d264 commit 3a1b99f
Show file tree
Hide file tree
Showing 27 changed files with 118 additions and 163 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,6 @@ AutomatedTests/*.png
/Installer/LatestBrainSimVersion.txt
/BrainSimulator.backup
/Installer/LatestBrainSimVersion.zip
/BrainSimII.zip
/Installer/BrainSimII_Setup.exe
/Installer/BrainSimII_Setup.zip
25 changes: 21 additions & 4 deletions BrainSimulator/BrainSimulator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
<BaseOutputPath>bin\</BaseOutputPath>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<Version>$(VersionPrefix)</Version>
<AssemblyVersion>1.6.8</AssemblyVersion>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<AssemblyVersion>1.7.8</AssemblyVersion>
<ApplicationIcon>Iconsmall.ico</ApplicationIcon>
<SourceRevisionId>build$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss"))</SourceRevisionId>
<PackageIcon>iconsmall.ico</PackageIcon>
</PropertyGroup>

<ItemGroup>
Expand All @@ -23,6 +24,12 @@
</ItemGroup>

<ItemGroup>
<Compile Remove="SplashScreenOld.xaml.cs" />
</ItemGroup>

<ItemGroup>
<None Remove="bsicon.ico" />
<None Remove="favicon.ico" />
<None Remove="Networks\3DSim.xml" />
<None Remove="Networks\BabyTalk.xml" />
<None Remove="Networks\BasicNeurons.xml" />
Expand Down Expand Up @@ -118,15 +125,21 @@
<None Remove="Resources\Play.png" />
<None Remove="Resources\Record.png" />
<None Remove="Resources\Rewind.png" />
<None Remove="Resources\SplashScreen2.png" />
<None Remove="Resources\Step.png" />
<None Remove="Resources\youtube-24.ico" />
<None Remove="Resources\ZoomIn.png" />
<None Remove="Resources\ZoomOut.png" />
<None Remove="Smoothed_Splash.bmp" />
</ItemGroup>

<ItemGroup>
<Page Remove="SplashScreenOld.xaml" />
</ItemGroup>

<ItemGroup>
<Content Include="bsicon.ico" />
<Content Include="favicon.ico" />
<Content Include="Iconsmall.ico" />
<Content Include="Networks\3DSim.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -330,11 +343,11 @@
<Resource Include="Resources\Play.png" />
<Resource Include="Resources\Record.png" />
<Resource Include="Resources\Rewind.png" />
<Resource Include="Resources\SplashScreen2.png" />
<Resource Include="Resources\Step.png" />
<Resource Include="Resources\youtube-24.ico" />
<Resource Include="Resources\ZoomIn.png" />
<Resource Include="Resources\ZoomOut.png" />
<Resource Include="Smoothed_Splash.bmp" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -396,6 +409,10 @@
</ItemGroup>

<ItemGroup>
<None Update="Iconsmall.ico">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
5 changes: 2 additions & 3 deletions BrainSimulator/FiringHistoryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ private void Dt_Tick(object sender, EventArgs e)
public void Draw()
{
//if you are not full-width or at end, don't repaint because it makes the image move around
bool atRightEnd = (int)(scroller.HorizontalOffset + scroller.RenderSize.Width) == (int)scroller.ExtentWidth;
bool atRightEnd = scroller.HorizontalOffset + scroller.RenderSize.Width == scroller.ExtentWidth;
bool fullWidth = scroller.RenderSize.Width == scroller.ExtentWidth;
if (theCanvas.Children.Count != 0 && !atRightEnd && !fullWidth)
return;
if (theCanvas.Children.Count != 0 && !atRightEnd && !fullWidth) return;
if (dragging) return;
ReallyDraw();
}
Expand Down
16 changes: 2 additions & 14 deletions BrainSimulator/GetUpdateDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows;

namespace BrainSimulator
{
Expand All @@ -28,7 +16,7 @@ private void ButtonGetUpdate_Click(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.CheckForUpdates = cbDontAsk.IsChecked == false;
Properties.Settings.Default.Save();
MainWindow.OpenApp("https://futureai.guru/BrainSimDownload.aspx");
MainWindow.OpenApp(MainWindow.webURL+"/technologies/BrainSimII-download");
this.Close();
MainWindow.thisWindow?.Close();
}
Expand Down
1 change: 0 additions & 1 deletion BrainSimulator/Help.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<Grid>
<WebBrowser Name="theBrowser" Margin="48,40,55,75"/>
<Button Name="theButton" Content="OK" Height="29" Width="120" Margin="339,0,0,21" IsCancel="True" VerticalAlignment="Bottom" Click="Button_Click" HorizontalAlignment="Left"/>
<Button Name="registerButton" Content="Register" Height="29" Width="120" Margin="502,0,0,21" IsCancel="True" VerticalAlignment="Bottom" Click="RegisterButton_Click" HorizontalAlignment="Left"/>
<CheckBox Name="theCheckBox" Content="Don't show this at startup" HorizontalAlignment="Left" Margin="158,0,0,26" Width="163" Height="17" VerticalAlignment="Bottom"/>
</Grid>
</Window>
4 changes: 0 additions & 4 deletions BrainSimulator/Help.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,5 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs

}

private void RegisterButton_Click(object sender, RoutedEventArgs e)
{
MainWindow.OpenApp("https://futureai.guru/BrainSimRegister.aspx");
}
}
}
2 changes: 1 addition & 1 deletion BrainSimulator/HelpAbout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<Label x:Name="labelContributors" HorizontalAlignment="Left" Height="158" Margin="317,47,0,0" VerticalAlignment="Top" Width="141"/>
<Label x:Name="label" Content="Project Contributors:" HorizontalAlignment="Left" Height="28" Margin="317,19,0,0" VerticalAlignment="Top" Width="141" FontWeight="Bold"/>
<Label x:Name ="labelVersion" HorizontalAlignment="Left" Height="46" Margin="35,0,0,66" VerticalAlignment="Bottom" Width="423"/>
<Image x:Name="image_Copy" Margin="19,19,168,117" Source="Smoothed_Splash.bmp"/>
<Image x:Name="image_Copy" Margin="19,19,168,117" Source="resources/SplashScreen2.png"/>
</Grid>
</Window>
Binary file added BrainSimulator/Iconsmall.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions BrainSimulator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@
</StackPanel>
</MenuItem.Header>
</MenuItem>
<MenuItem Header="Register" Click="MenuItemRegister_Click" >
<!--<MenuItem Header="Register" Click="MenuItemRegister_Click" >
<MenuItem.Icon>
<Image Source="/resources/mailing-list-icon-17.jpg"></Image>
</MenuItem.Icon>
</MenuItem>
</MenuItem>-->
<MenuItem Header="Help Contents" Click="MenuItemOnlineHelp_Click" >
<MenuItem.Icon>
<TextBlock FontSize="16" FontFamily="Segoe MDL2 Assets" Foreground="#FF00539C" >&#xE897;</TextBlock>
Expand Down
2 changes: 1 addition & 1 deletion BrainSimulator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public partial class MainWindow : Window
public static string currentFileName = "";

public static MainWindow thisWindow;
readonly Window splashScreen = new SplashScreeen();
readonly Window splashScreen = new SplashScreen();

public ProgressDialog progressDialog;

Expand Down
121 changes: 56 additions & 65 deletions BrainSimulator/MainWindowEventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,25 +382,7 @@ private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<d
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//close any help window which was open.
Process[] theProcesses1 = Process.GetProcesses();
for (int i = 1; i < theProcesses1.Length; i++)
{
try
{
if (theProcesses1[i].MainWindowTitle != "")
{
if (theProcesses1[i].MainWindowTitle.Contains("GettingStarted"))
{
theProcesses1[i].CloseMainWindow(); ;
}
}
}
catch (Exception e1)
{
MessageBox.Show("Window Clopsing Failed, Message: " + e1.Message);
}
}

CloseHelpWindow();

if (theNeuronArray != null)
{
Expand Down Expand Up @@ -713,63 +695,52 @@ private void MenuItemNotes_Click(object sender, RoutedEventArgs e)
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

public static string webURL = "https://futureai.guru";
//public static string webURL = "https://futureai1stg.wpenginepowered.com";
private void MenuItemHelp_Click(object sender, RoutedEventArgs e)
{
Uri theUri = new Uri("https://futureAI.guru/help/getting started.htm");

//first check to see if help is already open
Process[] theProcesses1 = Process.GetProcesses();
Process latestProcess = null;
for (int i = 1; i < theProcesses1.Length; i++)
{
try
{
if (theProcesses1[i].MainWindowTitle != "")
{
if (theProcesses1[i].MainWindowTitle.Contains("GettingStarted"))
latestProcess = theProcesses1[i];
}
}
catch (Exception e1)
{
MessageBox.Show("Opening Help Item Failed, Message: " + e1.Message);
}
}
CloseHelpWindow();
string thePage = "/BrainSimHelp/GettingStartedLauncher.html";
OpenBrowserWindowAndRepositionIt(thePage);
}

private void OpenBrowserWindowAndRepositionIt(string thePage)
{
Process helpProcessTab = null;

if (latestProcess == null)
{
OpenApp("https://futureai.guru/BrainSimHelp/gettingstarted.html");
OpenApp(webURL + thePage);

//gotta wait for the page to render before it shows in the processes list
DateTime starttTime = DateTime.Now;
//gotta wait for the page to render before it shows in the processes list
DateTime starttTime = DateTime.Now;

while (latestProcess == null && DateTime.Now < starttTime + new TimeSpan(0, 0, 3))
while (helpProcessTab == null && DateTime.Now < starttTime + new TimeSpan(0, 0, 3))
{
Process[] theProcesses = Process.GetProcesses();
for (int i = 1; i < theProcesses.Length; i++)
{
theProcesses1 = Process.GetProcesses();
for (int i = 1; i < theProcesses1.Length; i++)
try
{
try
if (theProcesses[i].MainWindowTitle != "")
{
if (theProcesses1[i].MainWindowTitle != "")
if (theProcesses[i].MainWindowTitle.Contains("BrainSimII Help"))
{
if (theProcesses1[i].MainWindowTitle.Contains("GettingStarted"))
latestProcess = theProcesses1[i];
helpProcessTab = theProcesses[i];
goto found;
}
}
catch (Exception e1)
{
MessageBox.Show("Opening Help Item Failed, Message: " + e1.Message);
}
}
catch (Exception e1)
{
MessageBox.Show("Opening Help Item Failed, Message: " + e1.Message);
}
}
}

found: ;
try
{
if (latestProcess != null)
if (helpProcessTab != null)
{
IntPtr id = latestProcess.MainWindowHandle;
IntPtr id = helpProcessTab.MainWindowHandle;

Rect theRect = new Rect();
GetWindowRect(id, ref theRect);
Expand All @@ -785,6 +756,28 @@ private void MenuItemHelp_Click(object sender, RoutedEventArgs e)
}
}

private static void CloseHelpWindow()
{
//first check to see if help is already open
Process[] theProcesses = Process.GetProcesses();
for (int i = 1; i < theProcesses.Length; i++)
{
Process theProcess = theProcesses[i];
try
{
if (theProcess.ProcessName.ToLower().Contains("chrome"))
{
if (theProcess.MainWindowTitle.Contains("BrainSimII Help"))
theProcess.CloseMainWindow();
}
}
catch (Exception e1)
{
MessageBox.Show("Opening Help Item Failed, Message: " + e1.Message);
}
}
}

//This opens an app depending on the assignments of the file extensions in Windows
public static void OpenApp(string fileName)
{
Expand All @@ -797,25 +790,23 @@ public static void OpenApp(string fileName)
}
catch (Exception e)
{
MainWindow.thisWindow.SetStatus(0, "OpenApp: "+e.Message, 1);
MainWindow.thisWindow.SetStatus(0, "OpenApp: " + e.Message, 1);
}
}

private void MenuItemOnlineHelp_Click(object sender, RoutedEventArgs e)
{
OpenApp("https://futureai.guru/BrainSimHelp/ui.html");
CloseHelpWindow();
string thePage = "/BrainSimHelp/UILauncher.html";
OpenBrowserWindowAndRepositionIt(thePage);
//OpenApp(webURL + "/BrainSimHelp/UI.html");
}

private void MenuItemOnlineBugs_Click(object sender, RoutedEventArgs e)
{
OpenApp("https://github.com/FutureAIGuru/BrainSimII/issues");
}

private void MenuItemRegister_Click(object sender, RoutedEventArgs e)
{
OpenApp("https://futureai.guru/BrainSimRegister.aspx");
}

private void MenuItemOnlineDiscussions_Click(object sender, RoutedEventArgs e)
{
OpenApp("https://facebook.com/groups/BrainSim");
Expand Down
3 changes: 2 additions & 1 deletion BrainSimulator/MainWindowExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private async static void CheckForVersionUpdate(bool alwaysShow = false)
try
{
string onlineVersionString = "";
var response = await theHttpClient.GetAsync("https://futureai.guru/LatestBrainSimVersion.txt");
var response = await theHttpClient.GetAsync(webURL+"/LatestBrainSimVersion.txt");
if (response.IsSuccessStatusCode)
{
DateTime? fileDate = response.Content.Headers.LastModified?.DateTime;
Expand All @@ -61,6 +61,7 @@ private async static void CheckForVersionUpdate(bool alwaysShow = false)
s += "\nYou have the latest version";

GetUpdateDialog dlg = new GetUpdateDialog();
dlg.Owner = thisWindow;
dlg.UpdateInfo.Content = s;
dlg.cbDontAsk.IsChecked = !Properties.Settings.Default.CheckForUpdates;
dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
Expand Down
11 changes: 2 additions & 9 deletions BrainSimulator/ModuleViewMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void CreateContextMenu(int i, ModuleView nr, FrameworkElement r, C
cm.Items.Add(mi);

mi = new MenuItem();
mi.Header = new CheckBox { Name = "Enabled", Content = "Enabled", IsChecked = nr.TheModule.isEnabled, };
mi.Header = new CheckBox {Name="Enabled", Content = "Enabled",IsChecked=nr.TheModule.isEnabled, };
mi.StaysOpenOnClick = true;
cm.Items.Add(mi);

Expand Down Expand Up @@ -263,7 +263,7 @@ private static void Cm_Closed(object sender, RoutedEventArgs e)
cc = Utils.FindByName(cm, "Enabled");
bool isEnabled = true;
if (cc is CheckBox cb2)
isEnabled = (bool)cb2.IsChecked;
isEnabled = (bool) cb2.IsChecked;

cc = Utils.FindByName(cm, "AreaWidth");
if (cc is TextBox tb1)
Expand Down Expand Up @@ -488,13 +488,6 @@ public static void OpenSource(string fileName)
{
Process process = new Process();
string taskFile = @"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe";
if (!File.Exists(taskFile))
taskFile = @"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe";
if (!File.Exists(taskFile))
taskFile = @"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe";
if (!File.Exists(taskFile))
return;

ProcessStartInfo startInfo = new ProcessStartInfo(taskFile, "/edit " + fileName);
process.StartInfo = startInfo;
process.Start();
Expand Down
Binary file modified BrainSimulator/Resources/Entity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BrainSimulator/Resources/SplashScreen2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed BrainSimulator/Smoothed_Splash.bmp
Binary file not shown.
Loading

0 comments on commit 3a1b99f

Please sign in to comment.