« first day (656 days earlier)      last day (3493 days later) » 

7:00 PM
@KalaJ does your database get recreated everytime you start the app?
@MarkRichman paste xaml
 
I noticed if I do the checksum before the code I showed above it works
Now i'm just wondering is that legal?
I mean to say, is that correct way to check for database integrity?
on Startup()
WOuld that be alright?\
 
why do you think you need to check for database integrity
 
in case of database corruption
 
I might be on the right track now:
<TextBox Text="{Binding MainDbmdfFilePath, Mode=TwoWay}" Width="200" IsEnabled="{Binding ConnectToExistingMainDb}">
                        <TextBox.Style>
                            <Style>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding ConnectToExistingMainDb}" Value="False">
                                        <Setter Property="TextBox.Text" Value=""/>
                                    </DataTrigger>
                                </Style.Triggers>
 
is that something you are actively concerned about??
ii hav worked with a fair number of databases and never done anything like that
 
7:02 PM
@Julien, it's only just in case. It's a requirement for the software I'm working on
 
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(filename))
{
return md5.ComputeHash(stream);
}
}
 
@KalaJ when the database is open, it probably has read/write access to the .mdf file
 
that will get you the md5 of a file
 
The way I have it now SHA-256
 
seems weird that you wouldnt be able to do that just because there is a connector open
 
7:04 PM
and it gives me a long string
 
as it should
 
stupid question but what should I Do with that long string?
LOL
 
database open, meaning the database is running...
 
if i open a picture file in paint
i can still check its md5
 
is this like a db on a server?
if changes are being made to the db, isn't the mdf going to change?
 
7:05 PM
nah its local
 
localdb
 
the problem is if you have a hash
 
@MarkRichman Get it working?
 
you have to store it somewhere
but you cant use the db becasue it could be corrupt
really bizarre situation, i dont think thats really a normal operation
 
@TyMorrow testing now
 
7:06 PM
@MarkRichman <Setter Property="TextBox.Text" Value=""/> breaking the binding
 
i think you just want Text
 
@NETscape oh?
 
not TextBox.Text
 
if you close the connection then open the connection your binding is gone
here you're binding: Text="{Binding MainDbmdfFilePath, Mode=TwoWay}"
 
"The member Text is not recognizeable or not accessible"
 
7:07 PM
change to resources style
 
Here your binding is... gone, it doesn't know to bind to MainDbmdfFilePath again: <Setter Property="TextBox.Text" Value=""/>
 
<TextBox><TextBox.Resources><Style TargetType={x:Type TextBox}><Style.Triggers>
text isnt recognizable because it doesnt know what type your style is targetting
 
that doesnt work
 
yes it does :)
 
x:Key attribute required?
 
7:08 PM
no
 
oh <Style TargetType="{x:Type TextBox}">
didnt see TargetType
 
yes
 
and now it accepts <Setter Property="Text" Value=""/>
 
yeah beacuse it can see that TextBox has a Text prop
 
<TextBox Text="{Binding MainDbmdfFilePath, Mode=TwoWay}" Width="200" Height="24" Margin="0,0,10,10" IsEnabled="{Binding ConnectToExistingMainDb}">
                        <TextBox.Resources>
                            <Style TargetType="{x:Type TextBox}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding ConnectToExistingMainDb}" Value="False">
                                        <Setter Property="Text" Value=""/>
                                    </DataTrigger>
 
7:09 PM
yeyey
you may have to clear the MainDbmdfFilePath in code behind when the checbox value changes
not sure
 
oh jeez
 
EventToCommand
 
that was my whole problem in the first place!
 
its pretty easy to do
 
in the setter
that's what was failing
 
7:10 PM
Lol
 
code behind != mvvm! :p
 
or do you mean on the actual TextBox control?
 
i am MVVM here
 
code behind in the view model is perfectly acceptable
and there are situations when just plainc ode behind > mvvm
 
7:10 PM
ok well that was my problem an hour ago
 
changing Text in code behind = non-mvvm
 
you wouldnt change Text, you would change the view model property that Text is bound to
 
trigger doesnt work
 
....
 
you also have other options like making the mode OneTime
 
7:11 PM
setting the text to string.Empty or "" or anything breaks the binding....
 
so it just reads it at startup
??
no it doesnt
 
my checkbox is flipping the IsEnabled state of the TextBox just like I had before
the DataTrigger seems to have no effect
 
example inc
 
the text is still in the textbox, enabled or not
 
saying Text="{Binding ToProp}" then Text="" is breaking the binding.
 
7:12 PM
ahhh yeah maybe
 
ok so i just wasted an hour
 
@NETscape Can you set the binding to TwoWay to not break the binding?
 
my bindings are already TwoWay
 
Mark can you post both the relevant View and ViewModel code together once more?
 
XAML?
 
7:14 PM
Yeah
 
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" IsChecked="{Binding ConnectToExistingMainDb, Mode=TwoWay}" ToolTip="To connect to an existing Talisma Main database, specify the path of the .mdf file" Content="Connect to existing Main database" />

                <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3">
                    <Label Content="File Path:" />
                    <TextBox Text="{Binding MainDbmdfFilePath, Mode=TwoWay}" Width="200" Height="24" Margin="0,0,10,10" IsEnabled="{Binding ConnectToExistingMainDb}">
public bool ConnectToExistingMainDb
{
get { return _connectToExistingMainDb; }
set
{
_connectToExistingMainDb = value;
if (!_connectToExistingMainDb && DatabaseType.Equals(DatabaseType.Main))
{
MainDbmdfFilePath = string.Empty;
}
}
}
 
@Julien, onStartup I got the hash, onExit, I would need to compute the hash again
and check if the values are the same
 
lol
why bother??
if your db is getting corrupted while your app is running and not even making any changes
you got big problems
 
at that point i am suprised your computer is still running
 
7:16 PM
Lol my db is not corrupted
 
@MarkRichman, can you try something for me? Remove all the Trigger stuff (take it back to the way you had it) and then remove the IsEnabled binding on the TextBox. Then breakpoint inside the ConnectToExistingMainDb setter and check the value
check the value of "value"
 
lol Julien true
but idk
apparently this is necessary
 
<i:Interaction.Triggers>
    <i:EventTrigger EventName="IsEnabledChanged">
        <i:InvokeCommandAction Command="{Binding ClearDBTextCommand}"
                               CommandParameter="{Binding Text, ElementName=textBox}" />
    </i:EventTrigger>
</i:Interaction.Triggers>
still MVVM, still easy, no code behind.... why not?
 
ok i have a hack
instead of setting the text property in the trigger
set the foreground property to white :)
you can also disable the textbox
@NETscape it is the text binding that stops the trigger from working
 
That works.
He said it's only this checkbox/textbox pair that is breaking
 
7:20 PM
my beef with that is generally if there is a value inthe textbox
and you check/uncheck the checkbox
 
i think i found a bug elsewhere that may be resetting that setter to false
hold...
 
should the original value reappear
 
can always have a backing field
 
more ugliness in code behind :)
 
FIXED!!!!!
THANK YOU ALL!
 
7:21 PM
code behind?
view models don't have code behind
 
This works:
public bool ConnectToExistingMainDb
        {
            get { return _connectToExistingMainDb; }
            set
            {
                _connectToExistingMainDb = value;
                if (!_connectToExistingMainDb && DatabaseType.Equals(DatabaseType.Main))
                {
                    MainDbmdfFilePath = string.Empty;
                }
            }
        }
i had another piece of code manipulating ConnectToExistingMainDb separate from the UI
 
....
 
it works now
 
lolz
 
i only hit my breakpoint now in cases where _connectToExistingMainDb is false, as expected
normally i'd blame the other asshole who fucked with my code
but in this case, i'm the only asshole on this project :)
Thanks for the trigger tutorial :)
 
7:23 PM
Good luck man
 
lol great mark
 
man that was frustrating
i actually dont think i need the trigger now lol
 
You don't
 
that was fun though :)
I still hate WPF
Does everyone love to hate WPF?
 
I just love it
 
7:25 PM
hahah fair enough
it is superior to WinForms
 
Every problem I ever have with WPF is my fault.
 
yes I'm learning that too
 
There are things I wish were different
 
user3010322
Slightly unrelated, Bizarre question.
 
but I still have never seen a UI framework/tech that works as well as WPF
 
7:25 PM
Reed, most people aren't like you though
 
user3010322
Actually, I won't ask it here.
 
user3010322
That'd be rude.
 
user3010322
Nevermind me!
 
I don't understand WPF well enough to critique or push one of it's boundaries
 
i haven't seen anything work as well as WPF either. did you misread that Ty? lol
 
7:27 PM
@ThePhD Go ahead :) people ask weird stuff all the time
 
@NETscape Sorry?
 
How do I run that command?
 
user3010322
Uh. Well it's about XML Serializatio and... stuff.
 
what have you seen run better than WPF?
 
7:28 PM
I haven't seen anything better.
 
user3010322
Like. On one of my dumb-data classes, I have a List<Base> Bases;
 
user3010322
When I de/serialize some things, will it check to see if it's a DerivedA and then write the XML as a DerivedA ?
 
@TyMorrow I don't get what this means then
 
@ThePhD depends on the serializer you use
 
user3010322
What would the standard XmlSerializer do?
 
7:29 PM
I didn't communicate well with that statement. I meant to say that @ReedCopsey seems like he understands things better than most with WPF so when he says he wishes things were different, that's because he understands the limits.
 
user3010322
Just write a bunch of Base ?
 
ahh
I thought it was regarding to the statement he made after that :p
 
I tried Qt and I had seen WinForms
When i ran from Qt, I looked at WinForms, but when I did, everything I read told me to just use WPF
I have also played with Java.Swing
Not sure which I detest more: Qt or Java.Swing
 
when i was first reading up on WPF everyone was saying its old and no one uses it......
 
Honestly...
There quite a few old posts on StackOverflow (that are still relevant)
it'd be easy to think it's outdated
 
7:32 PM
@ThePhD It depends - but its pretty dumb, usually
typically you need to manage IXmlSerializable yourself, which is a bit of a pain
 
user3010322
Yeeeep just gonna split the list up.
 
@TyMorrow Swing is much worse than Qt
Qt isn't bad - other than you pretty much need to use C++ :p
 
@ReedCopsey Well I defer to your knowledge then. I didn't spend enough time with Qt to get a good feel. I just felt the documentation and IDE was very poor.
 
@ThePhD it will serialize correctly
 
yeah i am also pretty sure it will serialize correctly
i do similar stuff but with JSON and it has no issues with base classes
 
7:34 PM
@TyMorrow Ide is crap - but you do'nt need it for anything
@Julien JSON serializers are smarter than XmlSerializer
 
hm
 
:O Are you saying I'd have to compile from the command line?!?!
 
XmlSerializer can handle it in some cases, but falls down frequently
@TyMorrow No - you can use Visual Studio, etc
just don't use their IDE
 
if you are drag and dropping controls into VS
you fail
 
if you base classes are abstract
 
7:35 PM
Qt + Visual C++?
 
like I have
you can do
[XmlInclude(typeof(BaseA))]
[XmlInclude(typeof(BaseB))]
public abstract class Base { .... }
 
@TyMorrow Yeah - that works
 
but i think that might be more for deserializing
 
Well, I'll be damned. I didn't know that.
 
@NETscape Yeah - works most of the time - kind of crappy, since you're coupling the serialization into the class (which kind of defeats the purpose of having a serializer), and the base needs to know about all of its subclasses
 
7:38 PM
well i wrote xml first and tried to deserialize vs write code first and serialize
 
Guys, I want to run something by you all. I read in an xml file at execution (for persistence) that has a bunch of custom controls defined. I.e., properties, types. I manually build all of the controls and setup their bindings. Then I would allow the user to modify these custom controls from within the app (modifies the xml file). Doable?
Kinda lets them build their own UI to a limited degree.
 
@TyMorrow Yeah - I'd use something other than XML though - XML is just a pain :p
 
Recommendations? JSON?
 
probably easier/smaller
 
<Log>
    <Error .... />
    <Verbose .... />
    <Crash .... />
</Log>

can be deserialized in `public class Log { public List<Log> Logs { get; set; } }` if you use XmlElement and Include and what not...
or subsititute Log with Report if you want
rather than having to do
Report
    Logs
       Log Type="Error"
       Log Type="Verbose
....
or even worse
Report
    Logs
        Log
            Error
        Log
            Verbose
....
 
7:47 PM
@ReedCopsey Well now I'm excited. No more hard coding every little change someone needs. They can do it themselves.
 
@TyMorrow Just be aware that it can become a rabbit hole - can be hard to get the flexibility the users want without making the system unwieldy - esp. since they'll want more and more as they get a taste of customization
so make sure you're up front with your goals and limitations
 
@ReedCopsey Agreed. It will be fairly restricted to one or two templates they have to choose from.
 
just mention it as a warning - my company's main product is effectively a highly customizable toolset - and that's a good and a bad thing :)
but its tough to keep users happy once they get a taste of being able to do "their own thing"
 
@ReedCopsey do you have a support group for customers? or is it juust whoever answers the phone lol
 
Lol well luckily I have achieved full control of this project. My users are still thanking me for giving them something other than a terminal
 
7:53 PM
@NETscape We try to get people to send in support via email - but they can also call our corp. hq to get support
@NETscape and we have a SO-like q/a site, too
 
0/
 
ahh. corp. hq.... you make it sound like a 1000 person comapny...
 
lol
 
Question: Are you guys developing in a VM environment of just on your laptop?
 
desktop
 
7:56 PM
@NETscape Nah - but we have been selling products for >20 years now :)
 
i did last big project on VM, i found it a pain
 
I rarely develop on VMs - rather have dedicated development machines
but do a lot of testing on VMs
 
okay thank you much. I guess I can play with it ... just got a Windows Virtual PC built..
I guess for sure it is good in case I hose my main env.
 
what's the simplest way to write out a string to a file?
just use system.IO.Write
*System.IO.File.WriteAllLines?
 
Well, if its just one line (or includes the line breaks internally), WriteLine works fine
 
8:08 PM
ok thanks
I used WriteAllText
 
@ReedCopsey I have a Thing SelectedThing, List<Thing> Things, and Something SelectedSomething. SelectedThing and Things are bound to a combobox itemssource and selecteditem
when selectedsomething is changed, in what order should I update the combo box?
update the list, or update the selectedthing?
as in should be it NPC("SelectedSomething"); NPC("Things"); NPC("SelectedThing");?
 
8:24 PM
posted on August 06, 2014 by The .NET Team

Today we are happy to announce the alpha release of the .NET Portability Analyzer extension for Visual Studio. Please try it out. This add-in was created by our software developer intern Charles Lowell. Over the last few years, consumers and enterprise employees are using more devices than before which run different operating systems like iOS, Android, Windows Phone, and Windows 8. As a resul

 
If I have something like this:
actually nevermind figured it out I think
lol
 
shouldn't matter too much, I don't think
 
I just realized something, I'm comparing two strings and they are identical but for some reason, the if condition for String.Compare still fails
This should return true
if (String.Compare(m_checksum, exit_checksum, true).Equals(true))
{
Console.WriteLine("Checksum works");
}
else
{

Console.WriteLine("Checksum fails");
}
but it returns false/else
 
hi huys, i need to display image in datagrid without binding. any help ?
 
String.Compare returns 0 if the two strings match
0.Equals(True) == false
if you are comparing checksum just use straight up ==
i dont think you need string.compare or equals, pure overkill
@redaa not enough info
 
8:33 PM
I can I use string.compare == true?
 
how do you know what image to show if you have no binding info
you can use if(m_checksum == exit_checksum)
 
oh
lol duh
thanks
 
np
 
you must find this odd, but i have a window called displaydetails , this window take a List<T> in constructor and display this list in datagrid, one class contains an imageSource Property, i need the application to automatically displays the image
 
and whats up with people and datagrids
such a terriblec ontrol
so why cant you use binding
because some of your T's dont have an image source?
 
8:35 PM
yes
 
you should use a selector that will choose a template based on the type of T
so you can have a template with an image binding and one without
 
and one T have ImageSource, if i create an Image control it will be displayed also if the T doesn't contain image
 
yeah you want templates
DataTemplateSelector
i am going home
good luck sir
 
checking whitch template os not good solution for me
@Julien thanks
OTHERS too thanks
 
uhhh, checking which template isn't good? how not so?
 
8:42 PM
0/
 
@NETscape I don't know if i can make the datagrid automatically detect the ImageSource and display it, you're the pro tell me if i can :)
 
odd question but only my viewmodel recognizes dialogService, but I want to pop up a dialog in app.xaml.css, how do I do that?
 
you mean app.xaml.cs?
 
yes lol
opps
app.xaml.cs
 
8:48 PM
why do you want to do this in app.xaml.cs?
 
In event of a database corruption, I pop up a message that the database is corrupted. See admin or something lol
 
@KalaJ take a break you're tired
 
lol
I'm running the checksum in app.xaml.cs
I could use messagebox.show() but I want to use my custom message dialog
 
why not do this DB checking and what not in the Loaded event of MainWindow?
and Unloaded
 
I want to do this before the database is open (used by another process)
 
8:54 PM
you can do that....
in your MainWindow.xaml.cs....
the Loaded event of MainWindow gets called before the constructor... I think... if not, the Initializing event does.
 
I will double
*double check
but I am doing something like this in my app.xaml.cs
MainWindowViewModel viewModel = new MainWindowViewModel();

this.MainWindow = new MainWindow();
this.MainWindow.DataContext = viewModel;
this.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;

Helper.WindowDialogService.SetOwner(this.MainWindow);

viewModel.Init();

this.MainWindow.Show();
which happens after I use the db
After I create the db
 
9:08 PM
@NETscape Nothing happens before the constructor... it can't
 
doh, right... i misspoke
I'm not sure why you would do that @KalaJ
where are you doing that?
App.xaml.cs?
oh you already said in app.xaml.cs
what is your Startup object on your project @KalaJ?
 
9:30 PM
where? The onStartup() Is in app.xaml.css
damn
.cs
lol
In the event of laziness, for now, if I want to use Messagebox.show(), how do I make it appear longer on the screen? It disappears after a second
 
 
1 hour later…
user3010322
11:03 PM
Hey, uh.
 
user3010322
A quick question.
 
user3010322
WIndows 8.1... when you try to open a file (using the Windows 8.1 API)...
 
user3010322
how exactly are you supposed to address it?
 
user3010322
11:46 PM
Welp, mfigured it out!
 
user3010322
Wooo.
 

« first day (656 days earlier)      last day (3493 days later) »